Ain = (2,8) Bin = (3,9) Cin = (7,9) loc = [Ain, Bin, Cin] Ago = (5,8) Bgo = (4,8) Cgo = (6,8) goal = [Ago, Bgo, Cgo] N = input() S = [list(input().split()) for _ in range(N)] for s in S: tar = (s[0], s[1]) mov = (s[2], s[3]) for i,l in enumerate(loc): if tar == l: loc[i] = mov flag = "YES" for i,l in enumerate(loc): if loc[i] != goal[i]: flag = "NO" print(flag)