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) { try (Scanner in = new Scanner(System.in)) { int n = in.nextInt(); int originalX = in.nextInt(); int originalY = in.nextInt(); boolean horizontal = true; boolean vertical = true; for (int a0 = 1; a0 < n; a0++) { int x = in.nextInt(); int y = in.nextInt(); if (x != originalX) { horizontal = false; } if (y != originalY) { vertical = false; } } if (horizontal || vertical) { System.out.println("YES"); } else { System.out.println("NO"); } } } }