import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); long []A = new long[N]; long []B = new long[N]; int count1 = 0; int count2 = 0; for(long i = 0; i < 2 * N; i++){ int k = scanner.nextInt(); if(i % 2 == 0) { A[count1] = k; count1++; }else if(i % 2 == 1){ B[count2] = k; count2++; } } int M = scanner.nextInt(); long []X = new long[M]; long []Y = new long[M]; int count3 = 0; int count4 = 0; for(long i = 0; i < 2 * M; i++){ long k = scanner.nextInt(); if(i % 2 == 0) { X[count3] = k; count3++; }else if(i % 2 == 1){ Y[count4] = k; count4++; } } scanner.close(); int []sumM = new int[M]; Arrays.fill(sumM, 0); // for(int i = 0; i < N; i++) { // System.out.println(A[i] + ", " + B[i]); // } // for(int i = 0; i < M; i++) { // System.out.println(X[i] + ", " + Y[i]); // } int flag = 0; for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) { if(X[j] <= A[i] && Y[j] >= B[i]) { sumM[j]++; flag = 1; } } } // 該当なし if(flag == 0) { System.out.println("0"); System.exit(0); } // for(int i = 0; i < M; i++) { // System.out.println(sumM[i]); // } int k = 0; int max = sumM[0]; int ans = 0; // System.out.println(sumM[101]); // System.out.println(sumM[117]); ArrayList array = new ArrayList(); for(int i = 0; i < M; i++) { k = sumM[i]; if(k == max) { array.add(i + 1); ans = i + 1; }else if(k > max) { max = k; ans = i + 1; array.clear(); array.add(i + 1); } } if(array.size() > 1) { for(int i = 0; i < array.size(); i++) { System.out.println(array.get(i)); } }else if(max != 0){ System.out.println(ans); } } }