import sequtils, strutils let n = parseInt readLine stdin xys = n.newSeqWith stdin.readLine.split.map parseInt var ps = {2:8, 3:9, 7:9} for v in xys: var x1, x2, y1, y2: int (x1, y1, x2, y2) = v if (x1, y1) in ps: let i = ps.find (x1, y1) ps[i] = (x2, y2) echo ["NO", "YES"][ord ps == {5:8, 4:8, 6:8}]