def inpl(): return list(map(int, input().split())) N = int(input()) G = [[0]*10 for _ in range(10)] G[2][8] = 1 G[3][9] = 2 G[7][9] = 3 for _ in range(N): px, py, qx, qy = inpl() G[px][py], G[qx][qy] = G[qx][qy], G[px][py] if G[5][8] == 1 and G[4][8] == 2 and G[6][8] == 3: print("YES") else: print("NO")