#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int i, j, k; int n, m; vector>ab, xy; cin >> n; for (i = 0; i < n; i++) { long a, b; cin >> a >> b; ab.push_back(make_pair(a, b)); } cin >> m; vectorans; for (i = 0; i < m; i++) { long x, y; cin >> x >> y; xy.push_back(make_pair(x, y)); int cnt = 0; for (j = 0; j < n; j++) { if (ab[j].first >= x && ab[j].second <= y) { cnt++; } } ans.push_back(cnt); } int maxnum = 0; for (i = 0; i < ans.size(); i++) { maxnum = max(maxnum, ans[i]); } if (maxnum == 0) { cout << 0 << endl; } else { for (i = 0; i < ans.size(); i++) { if (ans[i] == maxnum) { cout << i + 1 << endl; } } } getchar(); getchar(); return 0; }