#!/bin/python3 import sys n = int(input().strip()) dictX = {} dictY = {} for a0 in range(n): x,y = input().strip().split(' ') x,y = [int(x),int(y)] if x not in dictX: dictX[x] = 1 else: dictX[x] += 1 if y not in dictY: dictY[y] = 1 else: dictY[y] += 1 ans = "NO" for key,value in dictX.items(): if value == n: ans = "YES" for key,value in dictY.items(): if value == n: ans = "YES" print(ans)