N_28 = 28 N_39 = 39 N_79 = 79 N = int(input()) for i in range(N): x1, y1, x2, y2 = map(int, input().split()) if 10*x1 + y1 == N_28: N_28 = 10*x2 + y2 if 10*x1 + y1 == N_39: N_39 = 10*x2 + y2 if 10*x1 + y1 == N_79: N_79 = 10*x2 + y2 if N_28 == 58 and N_39 == 48 and N_79 == 68: print("YES") else: print("NO")