#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int32_t n; cin >> n; vector> abs(n); for (auto i = 0; i < n; ++i) { int32_t a, b; cin >> a >> b; abs[i] = {a, b}; } int32_t m; cin >> m; vector> xys(m); for (auto i = 0; i < m; ++i) { int32_t x, y; cin >> x >> y; xys[i] = {x, y}; } vector hist(m); for (auto i = 0; i < n; ++i) { for (auto j = 0; j < m; ++j) { if (abs[i].first >= xys[j].first && abs[i].second <= xys[j].second) { ++hist[j]; } } } vector> vs(m); for (auto i = 0; i < m; ++i) { vs[i] = {-hist[i], i + 1}; } sort(vs.begin(), vs.end()); if (vs[0].first == 0) { cout << 0 << endl; } else { cout << vs[0].second << endl; for (auto i = 1; i < m; ++i) { if (vs[i].first != vs[i - 1].first) break; cout << vs[i].second << endl; } } return 0; }