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 Xsame=true; boolean Ysame=true; int x=0; int y=0; int slope=Integer.MIN_VALUE; for(int a0 = 0; a0 < n; a0++){ if(a0==0){ x = in.nextInt(); y = in.nextInt(); }else{ int tempX = in.nextInt(); if(Xsame && tempX!=x) Xsame=false; int tempY = in.nextInt(); if(Ysame && tempY!=y) Ysame=false; } } System.out.println((Xsame || Ysame) ?"YES":"NO"); } }