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