#!/bin/python import sys cx=[] cy=[] f=0 n = int(raw_input().strip()) for a0 in xrange(n): x,y = raw_input().strip().split(' ') x,y = [int(x),int(y)] cx.append(x) cy.append(y) x=cx[0] y=cy[0] cox=cx.count(x) coy=cy.count(y) if(cox==n or coy==n): print "YES" else: print "NO"