from sys import stdin def main(): N = int(input()) XY = [tuple(map(int, input().split())) for _ in [0] * N] board = [[0] * 10 for _ in [0] * 10] board[2][8] = 1 board[3][9] = 2 board[7][9] = 3 for x1, y1, x2, y2 in XY: board[x1][y1], board[x2][y2] = board[x2][y2], board[x1][y1] if all((board[5][8] == 1, board[4][8] == 2, board[6][8] == 3)): print('YES') else: print('NO') input = lambda: stdin.readline()[:-1] main()