import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Mentaiko { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int []A = new int[N]; int []B = new int[N]; int count1 = 0; int count2 = 0; for(int 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(); int []X = new int[M]; int []Y = new int[M]; int count3 = 0; int count4 = 0; for(int i = 0; i < 2 * M; i++){ int 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); 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++; } } } // 該当なし 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; 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(); } } 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); } } }