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) { Scanner in = new Scanner(System.in); int n = in.nextInt(); boolean hor = true; boolean ver = true; int x = in.nextInt(); int y = in.nextInt(); for(int a0 = 0; a0 < n -1; a0++){ int x2 = in.nextInt(); int y2 = in.nextInt(); if(x2!=x) ver = false; if(y2!=y) hor = false; x=x2;y=y2; } System.out.println(ver | hor ? "YES" : "NO"); } }