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 scanner = new Scanner(System.in); int n = scanner.nextInt(); boolean isXsame = true; boolean isYsame = true; int prevX = scanner.nextInt(); int prevY = scanner.nextInt(); boolean flag = true; for(int i = 1; i< n; i++){ int x = scanner.nextInt(); int y = scanner.nextInt(); if(x != prevX){ isXsame = false; } if(y != prevY){ isYsame = false; } } System.out.println((isXsame || isYsame)==true?"YES":"NO"); } }