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(); int x = in.nextInt(); int y = in.nextInt(); int storex=x,storey=y,flagx=0,flagy=0; for(int a0 = 0; a0 < n-1; a0++){ x = in.nextInt(); y = in.nextInt(); if(storex==x) flagx++; if(storey==y) flagy++; } if(flagx==n-1 || flagy==n-1) System.out.print("YES"); else System.out.print("NO"); } }