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(); int x = in.nextInt(); int y = in.nextInt(); boolean rX = true; boolean rY = true; for(int a0 = 1; a0 < n; a0++){ int x1 = in.nextInt(); int y1 = in.nextInt(); if (x != x1) { rX = false; } if (y != y1) { rY = false; } if (!rX && !rY) { break; } } System.out.println((rX || rY) ? "YES" : "NO"); } }