import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer line = new StringTokenizer(input.readLine()); int n = Integer.parseInt(line.nextToken()); int[] xs = new int[n]; int[] ys = new int[n]; boolean vert = true, hori = true; for (int i = 0; i < n; i++) { line = new StringTokenizer(input.readLine()); xs[i] = Integer.parseInt(line.nextToken()); ys[i] = Integer.parseInt(line.nextToken()); } for (int i = 1; i < n; i++) { if (xs[i] != xs[i - 1]) { vert = false; } if (ys[i] != ys[i - 1]) { hori = false; } } System.out.println((vert || hori) ? "YES" : "NO"); } }