import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class A { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out; public static String next() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } public static int nextInt() throws IOException { return Integer.parseInt(next()); } public static long nextLong() throws IOException { return Long.parseLong(next()); } public static double nextDouble() throws IOException { return Double.parseDouble(next()); } public static void main(String[] args) throws IOException { boolean res = true; boolean ok = true; int n = nextInt(); Point[] t = new Point[n]; t[0] = new Point(nextInt(), nextInt()); for (int i = 1; i < n; i++) { t[i] = new Point(nextInt(), nextInt()); if (i == 1) { if (t[i - 1].x == t[i].x) { ok = true; } else if (t[i - 1].y == t[i].y) { ok = false; } else { res = false; break; } } else if (ok) { if (t[i - 1].x != t[i].x) { res = false; break; } } else if (!ok) { if (t[i - 1].y != t[i].y) { res = false; break; } } } System.out.println(res ? "YES" : "NO"); } static boolean tmp(Point p1, Point p2, Point p3) { return distBetween(p3, p1) == distBetween(p3, p2) + distBetween(p1, p2); } static double distBetween(Point p1, Point p2) { return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); } }