void main(){ import std.stdio, std.string, std.conv, std.algorithm; int n; rd(n); auto a=new int[](n), b=new int[](n); foreach(i; 0..n) rd(a[i], b[i]); int m; rd(m); auto x=new int[](m), y=new int[](m); foreach(i; 0..m) rd(x[i], y[i]); auto c=new int[](m); foreach(i; 0..n)foreach(j; 0..m){ if(x[j]<=a[i] && y[j]>=b[i]) c[j]++; } auto mx=reduce!(max)(c); if(mx==0){writeln(0); return;} foreach(i, e; c)if(e==mx) writeln(i+1); } void rd(T...)(ref T x){ import std.stdio, std.string, std.conv; auto l=readln.split; assert(l.length==x.length); foreach(i, ref e; x){ e=l[i].to!(typeof(e)); } }