import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine(){ String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ MyScanner scanner = new MyScanner(); int n = scanner.nextInt(); int x1 = scanner.nextInt(); int y1 = scanner.nextInt(); int x2 = scanner.nextInt(); int y2 = scanner.nextInt(); int ok = 0; if (x1 == x2){ int i = 2; for (i = 2; i < n; i++) { x2 = scanner.nextInt(); y2 = scanner.nextInt(); if (x1 != x2) break; } if (i == n) System.out.println("YES"); else System.out.println("NO"); } else if (y1 == y2) { int i = 2; for (i = 2; i < n; i++) { x2 = scanner.nextInt(); y2 = scanner.nextInt(); if (y1 != y2) break; } if (i == n) System.out.println("YES"); else System.out.println("NO"); } else { System.out.println("NO"); } } }