n = int(input()) a = [2,8] b = [3,9] c = [7,9] las_a = [5,8] las_b = [4,8] las_c = [6,8] for i in range(n): x,y,nx,ny = map(int,input().split()) if x == a[0] and y == a[1]: a[0] = nx a[1] = ny elif x == b[0] and y == b[1]: b[0] = nx b[1] = ny elif x == c[0] and y == c[1]: c[0] = nx c[1] = ny else: pass if a == las_a and b == las_b and c == las_c: print("YES") else: print("NO")