var cas,xx,n,m,k,q,i,x1,y1,x2,y2,num1,num2:longint; a,b,c,d,x,y:array[1..100010]of longint; begin readln(cas); for xx:=1 to cas do begin fillchar(a,sizeof(a),0); fillchar(b,sizeof(b),0); readln(n,m,k,q); for i:=1 to k do begin readln(x[i],y[i]); a[x[i]]:=1; b[y[i]]:=1; end; if a[1]=1 then begin c[1]:=1; num1:=1; end else num1:=0; for i:=2 to n do if a[i]=1 then begin if a[i-1]=0 then inc(num1); c[i]:=num1; end else c[i]:=0; if b[1]=1 then begin d[1]:=1; num2:=1; end else num2:=0; for i:=2 to m do if b[i]=1 then begin if b[i-1]=0 then inc(num2); d[i]:=num2; end else d[i]:=0; for i:=1 to q do begin readln(x1,y1,x2,y2); if (c[x1]<>0) and (c[x2]<>0) and (c[x1]=c[x2]) or (d[y1]<>0) and (d[y2]<>0) and (d[y1]=d[y2]) then writeln('Yes') else writeln('No'); end; end; end.