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 previousx = 0; int previousy = 0; boolean checkx=false,checky=false; String result=""; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if(a0==0){ previousx=x; previousy=y; } if(a0>=1){ if(previousx==x){ if(a0==1){ checkx = true; } checkx = checkx; }if(previousx!=x){ checkx = false; }if(previousy==y){ if(a0==1){ checky = true; } checky = checky; }if(previousy!=y){ checky = false; } } } if(checkx||checky){ System.out.println("YES"); }else{ System.out.println("NO"); } } }