n = int(input()) x1, y1 = 2, 8 # 5, 8 x2, y2 = 3, 9 # 4, 8 x3, y3 = 7, 9 # 6, 8 for _ in range(n): x, y, a, b = map(int, input().split()) if x == x1 and y == y1: x1, y1 = a, b elif x == x2 and y == y2: x2, y2 = a, b elif x == x3 and y == y3: x3, y3 = a, b if x1 == 5 and y1 == 8 and x2 == 4 and y2 == 8 and x3 == 6 and y3 == 8: print("YES") else: print("NO")