I,R=input,range Q=R(int(I())) c=[] d=[] x=[] for q in Q: K,L,M,N,X=map(int,I().split()) c+=[[K,M]] d+=[[L,N]] x+=[X] y=sorted(list(set(X for X in x))+[-10**9,10**9]) N=len(y) z={y[i]:i for i in R(N)} def B(i,t,F): i+=1 while i<=N:F[i],i=F[i]+t,i+(i&-i) def C(r,F): a=0 i=min(r+1,N) while i:a,i=a+F[i],i-(i&-i) return a def A(l,r,t,F): B(l,-(l-1)*t,F[0]),B(r,r*t-t,F[0]),B(l,t,F[1]),B(r,-t,F[1]) def D(r,F): return C(r,F[0])+r*C(r,F[1]) def G(i,F): return D(i,F)-D(i-1,F) F=[[[[[0]*(N+1),[0]*(N+1)]for i in R(2)]for j in R(2)]for l in R(2)] for q in Q: for j in R(2): K,L=c[q][j],d[q][j] if K>0: l,r=-1,N-1 while l+10] A(m,N,L,F[0][j][0]),A(m,N,K,F[0][j][1]),A(r,N,L,F[1][j][0]),A(r,N,K,F[1][j][1]) elif K<0: l,r=0,N while l0] A(0,m,L,F[1][j][0]),A(0,m,K,F[1][j][1]),A(0,r,L,F[0][j][0]),A(0,r,K,F[0][j][1]) elif L>0:A(0,N,L,F[0][j][0]),A(0,N,L,F[1][j][0]) i=z[x[q]] print("YNeos"[[G(i,F[0][0][0]),G(i,F[0][0][1]),G(i,F[1][0][1])]!=[G(i,F[0][1][0]),G(i,F[0][1][1]),G(i,F[1][1][1])]::2])