#include "bits/stdc++.h" using namespace std; #define fastcin {\ cin.tie(0);\ ios::sync_with_stdio(false);\ } #define REP(i, a, b) for(int i = a; i < b; i++) #define RREP(i, a, b) for(int i = a; i > b; i--) #define print(x) cout << x << "\n" #define SORT(a, n) sort(a, a+n); #define REVERSE(a,n) reverse(a,a+n); #define VSORT(v) sort(v.begin(), v.end()); #define VREVERSE(v) reverse(v.begin(), v.end()); #define MOD 1000000007 typedef long long ll; int main() { fastcin; int N; cin >> N; int q[10000][2]; REP(i, 0, N) cin >> q[i][0] >> q[i][1]; int M; cin >> M; int m[1000][3] = {}, max, count; REP(i, 0, M) { cin >> m[i][0] >> m[i][1]; REP(j, 0, N) { if(m[i][0]<=q[j][0] && m[i][1]>=q[j][1]) m[i][2]++; } if(max < m[i][2]) max = m[i][2]; } vector k; if(max) { REP(i, 0, M) { if(m[i][2] == max) { k.push_back(i+1); } } } int s = k.size(); if(s!=0) { REP(i, 0, s) print(k[i]); } else print(0); return 0; }