#include #define MAX_N 100001 #define INF_INT 2147483647 #define INF_LL 9223372036854775807 #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; typedef long long int ll; typedef pair P; bool isPrime(int n){ if(n == 2) return true; if(n % 2 == 0) return false; int sqr = sqrt(n)+1; for(int i=3;i<=sqr;i++){ if(n % i == 0) return false; } return true; } int main() { int ma=-1,N,A[10001],B[10001],M,X[1001],Y[1001],bought[1001]={0}; cin >> N; REP(i,N)cin >> A[i] >> B[i]; cin >> M; REP(i,M)cin >> X[i] >> Y[i]; REP(i,N)REP(j,M){ if(X[j] <= A[i] && Y[j] >= B[i]){ bought[j+1]++; ma = max(ma,bought[j+1]); } } vector v(0); REP(i,1001){ if(bought[i] == ma) v.push_back(i); } if(v.size() == 0) cout << 0 << endl; else for(int i=0;i