#!/bin/python isV,isH = True,True n = int(raw_input().strip()) xb,yb = 0,0 for i in xrange(n): x,y = map(int,raw_input().strip().split(' ')) if i>0 and isV: isV = xb==x if i>0 and isH: isH = yb==y xb,yb = x,y print "{}".format("YES" if (isV or isH) else "NO")