#include #include #include using namespace std; typedef pair P; int main(){ int n;cin>>n; vector

p(n); for(int i = 0; n > i; i++){ cin>>p[i].first >> p[i].second; } int m;cin>>m; vector

f(m); vector

A(m); for(int i = 0; m > i; i++){ cin>>f[i].first >> f[i].second; A[i].first = 0; A[i].second = i+1; } for(int i = 0; m > i; i++){ for(int j = 0; n > j; j++){ if(p[j].first >= f[i].first && p[j].second <= f[i].second){ A[i].first++; } } } sort(A.begin(),A.end(),greater

()); vector Ans; for(int i = 0; A[0].first==A[i].first; i++){ Ans.push_back(A[i].second); } sort(Ans.begin(),Ans.end()); for(int i = 0; Ans.size() > i; i++){ cout << Ans[i] << endl; } }