import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static boolean isSameValues(int[] arr) { for (int i = 0; i < arr.length - 1; i++) { if (arr[i] != arr[i+1]) { return false; } } return true; } private static boolean isSameLine(int[] xs, int[] ys) { if (isSameValues(xs)) { return true; } else if (isSameValues(ys)) { return true; } else { return false; } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] xcoords = new int[n]; int[] ycoords = new int[n]; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); xcoords[a0] = x; ycoords[a0] = y; } System.out.println(isSameLine(xcoords, ycoords) ? "YES": "NO"); } }