#!/bin/python3 import sys is_x = True is_y = True prev_x = None prev_y = None n = int(input().strip()) prev_x, prev_y = input().strip().split(' ') prev_x, prev_y = [int(prev_x), int(prev_y)] for a0 in range(1, n): x,y = input().strip().split(' ') x,y = [int(x),int(y)] is_x = ((x == prev_x) and is_x) and True or False is_y = ((y == prev_y) and is_y) and True or False prev_x = x prev_y = y msg = (is_x or is_y) and 'YES' or 'NO' print(msg)