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[][] points = new int[n][2]; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); points[a0][0] = x; points[a0][1] = y; } int isLine = -1; if (points[0][0] == points[1][0]){ isLine = 0; }else if (points[0][1] == points[1][1]){ isLine = 1; } boolean toPrint = true; for (int i = 1; i < n; i++){ if (isLine == 0){ if (points[i][0] != points[i-1][0]){ toPrint = false; break; } }else if (isLine == 1){ if (points[i][1] != points[i-1][1]){ toPrint = false; break; } }else{ toPrint = false; break; } } System.out.println(toPrint?"YES":"NO"); } }