using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var N = int.Parse(ReadLine()); var A = new int[N]; var B = new int[N]; for (int i = 0; i < N; i++) { var AB = ReadLine().Split().Select(int.Parse).ToArray(); A[i]=AB[0]; B[i]=AB[1]; } var M =int.Parse(ReadLine()); var X = new int[M]; var Y = new int[M]; for (int i = 0; i < M; i++) { var XY = ReadLine().Split().Select(int.Parse).ToArray(); X[i]=XY[0]; Y[i]=XY[1]; } var c=new int[M]; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if(A[i]>=X[j]&&B[i]<=Y[j])c[j]++; } } if(c.Max()==0)WriteLine(0); else { foreach (var a in c.Select((x,i)=>x==c.Max()?i+1:0).Where(x=>x>0)) { WriteLine(a); } } } }