p=[[y*10+x for x in range(10)] for y in range(10)] N=int(input()) for i in range(N): ya,xa,yb,xb=map(int,input().split()) p[yb][xb],p[ya][xa]=p[ya][xa],0 if p[4][8]==39 and p[5][8] and p[6][8]: print("YES") else: print("NO")