#include #include #include #include #include #include using namespace std; int main(){ long long N,M,A[10001],B[10001],x,y,num=0,count; vector ans; cin >> N; for(int i=0;i> A[i] >> B[i]; } cin >> M; for(long long j=1;j<=M;j++){ count = 0; cin >> x >> y; for(int i=0;i=x&&B[i]<=y){ count++; } } if(num==count&&count!=0){ ans.push_back(j); } else if(num < count){ num = count; ans.clear(); ans.push_back(j); } } if(ans.size()==0){ cout << 0; } for(int i=0;i