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) { int firstX = 0; int firstY = 0; boolean xBroke = false; boolean yBroke = false; Scanner in = new Scanner(System.in); int n = in.nextInt(); for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if (a0 == 0){ firstX = x; firstY = y; } if ( firstX != x) { xBroke = true; } if ( firstY != y) { yBroke = true; } if (xBroke && yBroke) { System.out.println("NO"); break; } } if ( (xBroke && !yBroke) || (!xBroke && yBroke) ){ System.out.println("YES"); } } }