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 sc = new Scanner(System.in); int N = sc.nextInt(); int a[][] = new int[N][2]; int checkV = sc.nextInt(); int checkH = sc.nextInt(); boolean fv = true; boolean fh = true; for (int i = 1; i < N; i++) { a[i][0] = sc.nextInt(); a[i][1] = sc.nextInt(); if (checkV != a[i][0]) { // System.out.println(a[i][0]); fv = false; } if (checkH != a[i][1]) { // System.out.println(a[i][1]); fh = false; } } if (fv == true || fh == true) { System.out.println("YES"); } else { System.out.println("NO"); } } }