#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#include int main() { int n, m; cin >> n; vector>a,b; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; a.push_back(make_pair(x, y)); } cin >> m; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; b.push_back(make_pair(x, y)); } vectorp; int ans = 0; int w = 1; for (int i = 0; i < m; i++) { int t = 0; for (int j = 0; j < n; j++) { if (b[i].first <= a[j].first&&b[i].second >= a[j].second)t++; } if (ans == t) { p.push_back(i + 1); } if (ans < t) { // cout << i; w = i + 1; p.clear(); p.push_back(w); ans = max(ans, t); } } for (int i = 0; i < p.size(); i++) { cout << p[i] << endl; } return 0; }