#include#include using namespace std;struct form { int x1, y1, x2, y2; int id; int pri;};form arr[15];bool cmp (form a, form b){ return a.pri > b.pri;}int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> arr[i].x1 >> arr[i].y1 >> arr[i].x2 >> arr[i].y2; arr[i].id = i; arr[i].pri = i; } for (int i = 1; i <= m; i++) { int x, y; cin >> x >> y; sort(arr + 1, arr + n + 1, cmp); bool flag = false; for (int i = 1; i <= n; i++) { if (x >= arr[i].x1 && x <= arr[i].x2 && y >= arr[i].y1 && y <= arr[i].y2) { cout << arr[i].id << endl; arr[i].pri = arr[1].pri + 1; flag = true; break; } } if (!flag) cout << "IGNORED" << endl; } return 0;}