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 in = new Scanner(System.in); int n = in.nextInt(); boolean horizontal = false; int xprev=-1, yprev=-1; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if (a0 == 0) { xprev = x; yprev = y; } else if (a0 == 1) { if (xprev == x && yprev == y) continue; else if (xprev == x) horizontal = true; else if (yprev == y) horizontal = false; else { System.out.println("NO"); System.exit(0); } } else { if (horizontal) { if (xprev != x) { System.out.println("NO"); System.exit(0); } } else { if (yprev != y) { System.out.println("NO"); System.exit(0); } } } } System.out.println("YES"); } }