#!/bin/python import sys lastx = None lasty = None horizontal = True vertical = True n = int(raw_input().strip()) for a0 in xrange(n): x,y = raw_input().strip().split(' ') x,y = [int(x),int(y)] if not ((lastx is None) or (lasty is None)): if (vertical): vertical = False if (lasty != y) else True if (horizontal): horizontal = False if (lastx != x) else True if (horizontal is False) and (vertical is False): print "NO" break lastx = x lasty = y if (horizontal or vertical): print "YES"