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 x = true; boolean y = true; int x1 = in.nextInt(); int y1 = in.nextInt(); for(int a0 = 1; a0 < n; a0++){ int x2 = in.nextInt(); int y2 = in.nextInt(); x = x && x2 == x1; y = y && y2 == y1; } System.out.println(x || y ? "YES" : "NO"); } }