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