import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int nPoints = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int nextX = sc.nextInt(); int nextY = sc.nextInt(); if (x != nextX && y != nextY) { System.out.println("NO"); return; } boolean isExpectingHorz = true; if (x == nextX) { isExpectingHorz = false; } for (int i = 2; i < nPoints; ++i) { nextX = sc.nextInt(); nextY = sc.nextInt(); if (isExpectingHorz) { if (y != nextY) { System.out.println("NO"); return; } } else { if (x != nextX) { System.out.println("NO"); return; } } } System.out.println("YES"); } }