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(); int prevX = 0, prevY = 0; int sameX = 1; int sameY = 1; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); if(a0 != 0) { if(prevX != x) sameX = 0; if(prevY != y) sameY =0; } if(sameX==0 && sameY==0) { System.out.println("NO"); return; } prevX = x; prevY = y; } System.out.println("YES"); } }