import java.util.Scanner; import java.util.Stack; public class Solution { @SuppressWarnings("resource") public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); Stack x = new Stack(); Stack y = new Stack(); for(int a0 = 0; a0 < n; a0++){ x.add(in.nextInt()); y.add(in.nextInt()); } int countX = 0; int countY=0; while(!x.isEmpty()){ int a = x.pop(); if(!x.isEmpty()){ if(a == x.peek()){ countX++; } } } while(!y.isEmpty()){ int a = y.pop(); if(!y.isEmpty()){ if(a == y.peek()){ countY++; } } } if(countY==n-1 || countX==n-1){ System.out.println("YES"); }else{ System.out.println("NO"); } } }