201403-2 窗口
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;const int N = 15;int n, m;
struct Window {int x1, y1, x2, y2;int id;
} w[N];int get(int x, int y) {for (int i = n; i; i--)if (x >= w[i].x1 && x <= w[i].x2 && y >= w[i].y1 && y <= w[i].y2)return i;return 0;
}int main() {cin >> n >> m;for (int i = 1; i <= n; i++) {int x1, y1, x2, y2;cin >> x1 >> y1 >> x2 >> y2;w[i] = {x1, y1, x2, y2, i};}while (m -- ) {int x, y;cin >> x >> y;int t = get(x, y);if (!t) puts("IGNORED");else {cout << w[t].id << endl;auto r = w[t];for (int i = t; i < n; i++) w[i] = w[i + 1];w[n] = r;}}return 0;
}