n = int(input()) pos = [[2, 8], [3, 9], [7, 9]] for _ in range(n): x1, y1, x2, y2 = map(int, input().split()) if [x1, y1] in pos: print([x1, y1]) ind = pos.index([x1, y1]) pos[ind] =[x2, y2] if pos == [[5, 8], [4, 8], [6, 8]]: print("YES") else: print("NO")