#include int main() { int n; scanf("%d", &n); int i, j; int a[10004], b[10004]; for (i = 0; i < n; i++) scanf("%d %d", &a[i], &b[i]); int m; scanf("%d", &m); int x[1003], y[1003]; for (i = 0; i < m; i++) scanf("%d %d", &x[i], &y[i]); int c[1003]; for (i = 0; i < m; i++) c[i] = 0; for (i = 0; i < n; i++) for (j = 0; j < m; j++) if (x[j] <= a[i] && y[j] >= b[i]) c[j]++; int max = 0; for (i = 0; i < m; i++) if (max < c[i]) max = c[i]; if (max == 0) printf("0\n"); else { for (i = 0; i < m; i++) if (c[i] == max) printf("%d\n", i + 1); } return 0; }