# -*- coding: utf-8 -*- import sys import copy sys.setrecursionlimit(1000000) # input = sys.stdin.readline # from collections import defaultdict # import bisect # ~~~~~~~~~~~~~~~~~~~~~_(^~^ 」 ∠)_~~~~~~~~~~~~~~~~~~~~~ N = int(input()) A = [[0] * 10 for i in range(10)] A[2][8] = 1 A[3][9] = 2 A[7][9] = 3 for i in range(N): x1, y1, x2, y2 = map(int, input().split()) A[x1][y1], A[x2][y2] = A[x2][y2], A[x1][y1] if A[5][8] == 1 and A[4][8] == 2 and A[6][8]: print("YES") else: print("NO")