import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.*; public class Solution { public static void main(String[] args) { new Solution().solve(); } public void solve() { InputParser in = new InputParser(System.in); int n = in.readInt(); int[] x = new int[n]; int[] y = new int[n]; for (int i = 0; i < n; i++) { x[i] = in.readInt(); y[i] = in.readInt(); } boolean done = true; for (int i = 1; i < n; i++) { if (x[i-1] != x[i]) { done = false; break; } } if (!done) { done = true; for (int i = 1; i < n; i++) { if (y[i-1] != y[i]) { done = false; break; } } } if (done) { System.out.println("YES"); } else { System.out.println("NO"); } } private int linearSearch(int[] a, int key) { for (int i = 0; i < a.length; i++) { if (a[i] == key) return i; } return -1; } private void printInLine(int[] a, String separator) { for (int i = 0; i < a.length; i++) { System.out.print(a[i]); if (i < a.length - 1) System.out.print(separator); } } private class InputParser { private final InputStream inputStream; private byte lastByte = -1; public InputParser(InputStream inputStream) { if (inputStream instanceof BufferedInputStream) this.inputStream = inputStream; else this.inputStream = new BufferedInputStream(inputStream); } public int readInt() { return (int) readLong(); } public int[] readIntArray(int n) { int[] result = new int[n]; for (int i = 0; i < n; i++) { result[i] = readInt(); } return result; } public long readLong() { boolean negative = false; long result = 0; while ((lastByte < '0' || lastByte > '9') && lastByte != '-') readRawByte(); if (lastByte == '-') { negative = true; readRawByte(); } do { result *= 10; result += lastByte - '0'; readRawByte(); } while (lastByte >= '0' && lastByte <= '9'); if (negative) return -result; else return result; } public long readBinaryLong() { boolean negative = false; long result = 0; while (lastByte != '0' && lastByte != '1' && lastByte != '-') readRawByte(); if (lastByte == '-') { negative = true; readRawByte(); } do { result *= 2; if (lastByte == '1') result += 1; readRawByte(); } while (lastByte == '0' || lastByte == '1'); if (negative) return -result; else return result; } public long[] readLongArray(int n) { long[] result = new long[n]; for (int i = 0; i < n; i++) { result[i] = readLong(); } return result; } public void readRawByte() { try { lastByte = (byte) inputStream.read(); } catch (IOException e) { lastByte = -1; } } public String readShortString() { String s = ""; while (lastByte < 33 || lastByte > 126) readRawByte(); while (lastByte >= 33 && lastByte <= 126) { s += (char) lastByte; readRawByte(); } return s; } public String readString() { List buffers = new ArrayList<>(); CharBuffer currentBuffer = new CharBuffer(); while (lastByte < 33 || lastByte > 126) readRawByte(); while (lastByte >= 33 && lastByte <= 126) { currentBuffer.add((char) lastByte); if (currentBuffer.isFull()) { buffers.add(currentBuffer); currentBuffer = new CharBuffer(); } readRawByte(); } char[] result = new char[buffers.size() * CharBuffer.CAPACITY + currentBuffer.currentSize]; int i = 0; for (CharBuffer buffer : buffers) { for (int j = 0; j < CharBuffer.CAPACITY; j++) { result[i++] = buffer.buffer[j]; } } for (int j = 0; j < currentBuffer.currentSize; j++) { result[i++] = currentBuffer.buffer[j]; } return String.valueOf(result); } public String readLine() { List buffers = new ArrayList<>(); CharBuffer currentBuffer = new CharBuffer(); while (lastByte == 10 || lastByte == 13 || lastByte == -1) readRawByte(); while (lastByte != 10 && lastByte != 13 && lastByte != -1) { currentBuffer.add((char) lastByte); if (currentBuffer.isFull()) { buffers.add(currentBuffer); currentBuffer = new CharBuffer(); } readRawByte(); } char[] result = new char[buffers.size() * CharBuffer.CAPACITY + currentBuffer.currentSize]; int i = 0; for (CharBuffer buffer : buffers) { for (int j = 0; j < CharBuffer.CAPACITY; j++) { result[i++] = buffer.buffer[j]; } } for (int j = 0; j < currentBuffer.currentSize; j++) { result[i++] = currentBuffer.buffer[j]; } return String.valueOf(result); } private class CharBuffer { public static final int CAPACITY = 64; public final char[] buffer = new char[CAPACITY]; public int currentSize = 0; public void add(char b) { buffer[currentSize++] = b; } public boolean isFull() { return currentSize == CAPACITY; } } } }