# yukicoder@python3 N = int(input()) A = 28 B = 39 C = 79 mat = [[0 for j in range(1, 11)] for i in range(1, 11)] mat[2][8] = 1 mat[3][9] = 2 mat[7][9] = 3 for i in range(N): A = input().split() x1, y1, x2, y2 = map(int, A) # print(i,A) if mat[x1][y1] == 0: mat[x1][y1] = 10 # if mat[x2][y2] > 0: # print(mat[x2][y2]) assert mat[x1][y1] > 0 assert mat[x2][y2] <= 0 mat[x2][y2] = mat[x1][y1] mat[x1][y1] = -1 if mat[5][8] == 1 and mat[4][8] == 2 and mat[6][8] == 3: print("YES") else: print("NO")