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 hor = true; int x0 = 0, y0 = 0; String res = "YES"; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if (a0 == 0) { x0 = x; y0 = y; } else if (a0 == 1) { if (x0 == x) { hor = true; } else if (y0 == y) { hor = false; } else { res = "NO"; break; } } else { if (hor) { if (x0 != x) { res = "NO"; break; } } else { if (y0 != y) { res = "NO"; break; } } } } System.out.println(res); } }