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) { int h = 0 ,v = 0; Scanner in = new Scanner(System.in); int n = in.nextInt(); int a = in.nextInt(); int b = in.nextInt(); for(int a0 = 0; a0 < n-1; a0++){ int x = in.nextInt(); int y = in.nextInt(); if(x == a) h = 1 ; else h = 0; if(y == b) v = 1 ; else v = 0 ; if(h == 0 && v == 0) { System.out.println("NO"); break ; } } if(h == 1 || v == 1) System.out.println("YES"); } }