import java.util.*;
class Win {
public int x1, y1, x2, y2, id;
Win(int x1, int y1, int x2, int y2, int id) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.id = id;
}
public boolean isin(int a,int b){
return (x1 <= a && x2 >= a && y2 >= b && y1 <= b);
}
}
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();// n个窗口
int m = in.nextInt();// m次点击
List
Win[] wins = new Win[n];
for(int i=1;i<=n;i++)
list.add(new Win(in.nextInt(),in.nextInt(),in.nextInt(),in.nextInt(),i));
int[] click = new int[m];
for (int i = 0; i < m; i++) {//m次点击
int a = in.nextInt();
int b = in.nextInt();
for(int j=list.size()-1;j>=0;j--){//list末尾的在最上
if(list.get(j).isin(a, b)){//在区域内
click[i]=list.get(j).id;
list.add(list.get(j));//追加
list.remove(j);//移除
break;
}
}
}
for (int i = 0; i < m; i++) {
if (click[i] == 0) System.out.println("IGNORED");
else System.out.println(click[i]);
}
}
}