#include #include using namespace std; int main(){ int N; cin >> N; vector A(N), B(N); for (int i = 0; i < N; i++){ cin >> A[i] >> B[i]; } int M; cin >> M; vector X(M), Y(M); for (int i = 0; i < M; i++){ cin >> X[i] >> Y[i]; } vector cnt(M, 0); for (int i = 0; i < N; i++){ for (int j = 0; j < M; j++){ if (X[j] <= A[i] && Y[j] >= B[i]){ cnt[j]++; } } } int mx = 0; for (int i = 0; i < M; i++){ mx = max(mx, cnt[i]); } if (mx == 0){ cout << 0 << endl; } else { for (int i = 0; i < M; i++){ if (cnt[i] == mx){ cout << i + 1 << endl; } } } }