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 linex = true; boolean liney = true; int x2 = 0, y2 = 0; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if (a0 == 0) { x2 = x; y2 = y; } else { if (x2 != x) linex = false; if (y2 != y) liney = false; x2 = x; y2 = y; } } System.out.println(linex || liney ? "YES" : "NO"); } }