import java.io.*; import java.util.*; public class Main_yukicoder647 { private static Scanner sc; private static Printer pr; private static void solve() { 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[] cnt = new int[m]; int max = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (x[j] <= a[i] && y[j] >= b[i]) { cnt[j]++; max = Math.max(max, cnt[j]); } } } if (max == 0) { pr.println(0); } else { for (int i = 0; i < m; i++) { if (cnt[i] == max) { pr.println(i + 1); } } } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }