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 bigX = in.nextInt(); int bigY = in.nextInt(); Boolean vertical = null; Boolean horizontal = null; boolean res = true; for(int a0 = 1; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if(vertical == null && horizontal == null){ if(x == bigX && y != bigY){ vertical = true; } else if(y == bigY && x != bigX){ horizontal = true; } else if(y == bigY && x == bigX){ continue; } else{ res = false; break; } } if(vertical != null && vertical && x != bigX){ res = false; break; } if(horizontal != null && horizontal && y != bigY){ res = false; break; } } System.out.println(res ? "YES" : "NO"); } }