#!/bin/python import sys n = int(raw_input().strip()) xyes = True yyes = True for a0 in xrange(n): x,y = raw_input().strip().split(' ') x,y = [int(x),int(y)] if a0>0: if x != xprev: xyes = False if y != yprev: yyes = False xprev = x yprev = y if (xyes or yyes): print "YES" else: print "NO"