#!/bin/python import sys n = int(raw_input().strip()) for a0 in xrange(n): x,y = raw_input().strip().split(' ') x,y = [int(x),int(y)] if a0 == 0: p, q = x, y continue if (p != x) and (q != y): print "NO" sys.exit() print "YES"