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 horizontal = true; boolean vertical = true; int lastx = 0; int lasty = 0; for(int i = 0; i < n; i++){ int x = in.nextInt(); int y = in.nextInt(); if(0!=i){ if(x!=lastx){horizontal=false;} if(y!=lasty){vertical=false;} } lastx = x; lasty = y; } if(horizontal || vertical){ System.out.println("YES"); }else{ System.out.println("NO"); } } }