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[] xvals = new int[n]; int[] yvals = new int[n]; for(int a0 = 0; a0 < n; a0++){ xvals[a0] = in.nextInt(); yvals[a0] = in.nextInt(); } int xtest = xvals[0]; int ytest = yvals[0]; Boolean xflag = true; Boolean yflag = true; for (int i = 1; i < n; i++) { if (xtest != xvals[i]) xflag = false; if (ytest != yvals[i]) yflag = false; } if (xflag == true || yflag == true) System.out.println("YES"); else System.out.println("NO"); } }