import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main implements Runnable { void solve() throws IOException { int n = nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i=0; i<n; i++) { a[i] = nextInt(); b[i] = nextInt(); } boolean xok = true, yok = true; for (int i=1; i<n; i++) { xok &= a[i]==a[0]; yok &= b[i]==b[0]; } if (xok || yok) { out.print("YES"); } else { out.print("NO"); } } BufferedReader br; StringTokenizer st; PrintWriter out; public void run() { try { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); br.close(); out.close(); } catch (IOException e) { e.printStackTrace(); System.exit(123); } } String next() throws IOException { while (st == null || !st.hasMoreTokens()) { String s = br.readLine(); if (s == null) return null; st = new StringTokenizer(s); } return st.nextToken(); } double nextDouble() throws IOException { return Double.parseDouble(next()); } int nextInt() throws IOException { return Integer.parseInt(next()); } long nextLong() throws IOException { return Long.parseLong(next()); } public static void main(String[] args) { new Thread(new Main()).start(); } }