import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i = 0 ; i < n ; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); } int m = sc.nextInt(); int[] x = new int[m]; int[] y = new int[m]; for(int i = 0 ; i < m ; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); } int[] sum = new int[m]; for(int i = 0 ; i < m ; i++) { int cnt = 0; for(int j = 0 ; j < n ; j++) { if(a[j] >= x[i] && b[j] <= y[i]) cnt++; } sum[i] = cnt; } int max = -1; for(int i = 0 ; i < m ; i++) { max = Math.max(max, sum[i]); } if(max == 0) { System.out.println(0); return; } for(int i = 0 ; i < m ; i++) { if(sum[i] == max) { System.out.println(i + 1); } } } }