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(); boolean isHorizontal = false; boolean isVertical = false; int x1 = in.nextInt(); int y1 = in.nextInt(); int x2 = in.nextInt(); int y2 = in.nextInt(); if (x1 == x2) { isVertical = true; } if (y1 == y2) { isHorizontal = true; } if (!isVertical && !isHorizontal) { System.out.println("NO"); } else { for(int a0 = 2; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if (isVertical) { if (x != x1) { isVertical = false; System.out.println("NO"); break; } } if (isHorizontal) { if (y != y1) { isHorizontal = false; System.out.println("NO"); break; } } } if (isVertical || isHorizontal) { System.out.println("YES"); } } } }