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[] arrX = new int[n]; int[] arrY = new int[n]; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); arrX[a0] = x; arrY[a0] = y; } System.out.println(allOnLine(arrX, arrY)); } private static String allOnLine(int[] arrX, int[] arrY) { int presentX = arrX[0]; int presentY = arrY[0]; boolean allV = true; boolean allH = true; for(int i = 1; i < arrX.length; i++) { int nextX = arrX[i]; int nextY = arrY[i]; if(presentX != nextX) { allV = false; } if(presentY != nextY) { allH = false; } presentX = nextX; presentY = nextY; } if(allV || allH) { return "YES"; } return "NO"; } }