#import pysnooper #import os,re,sys,operator,math,heapq,string #from collections import Counter,deque #from operator import itemgetter #from itertools import accumulate,combinations,groupby,combinations_with_replacement from sys import stdin,setrecursionlimit #from copy import deepcopy setrecursionlimit(10**6) input=stdin.readline n=int(input().rstrip()) mas=[[0]*10 for _ in range(10)] now=[[""]*10 for _ in range(10)] now[8][2]="A" now[9][3]="B" now[9][7]="C" for i in range(n): x=list(map(int,input().split())) mas[x[1]][x[0]]=0 mas[x[3]][x[2]]=1 now[x[1]][x[0]],now[x[3]][x[2]]=now[x[3]][x[2]],now[x[1]][x[0]] if mas[8][5] and now[8][5]=="A" and mas[8][4] and now[8][4]=="B" and mas[8][6] and now[8][6]=="C": print("YES") else: print("NO")