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(); Integer xPos = null; Integer yPos = null; int xCount = 0; int yCount = 0; boolean ok = true; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); if(xPos == null) { xPos = x; } if(xPos.intValue() == x) { xCount++; } int y = in.nextInt(); if(yPos == null) { yPos = y; } if(yPos.intValue() == y) { yCount++; } } if(xCount == n || yCount == n) { System.out.println("YES"); } else { System.out.println("NO"); } } }