n = int(input()) start = [[2,8],[3,9],[7,9]] for i in range(n): xy = list(map(int,input().split())) xy1 = xy[:2] xy2 = xy[2:] if xy1 in start: start[start.index(xy1)]=xy2 print("YES") if start==[[5, 8], [4, 8], [6, 8]] else print("NO")