N, *I = map(int, open(0).read().split()) B = [[(j, i) for i in range(10)] for j in range(10)] for x1, y1, x2, y2 in zip(*[iter(I)] * 4): B[x2][y2] = B[x1][y1] if B[5][8] == (2, 8) and B[4][8] == (3, 9) and B[6][8] == (7, 9): print("YES") else: print("NO")