#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; vector> A(N); for(auto &[x, y] : A) cin >> x >> y; int M; cin >> M; vector> B(M); for(auto &[x, y] : B) cin >> x >> y; vector cnt(M, 0); rep(i,M)rep(j,N)cnt[i] += B[i].first <= A[j].first && B[i].second >= A[j].second; int ma = *max_element(cnt.begin(), cnt.end()); if(ma == 0) { cout << 0 << endl; } else { rep(i,M) if(ma == cnt[i]) cout << i + 1 << '\n'; } }