/*input 5 0 1 0 2 1 3 0 4 0 5 */ #include using namespace std; typedef unsigned long long int ull; typedef long long int lli; typedef pair ii; typedef vector vi; typedef vector vii; #define rep(i,n) for(int i = 0; i < n; i++) #define INF 0x3f3f3f3f #define NEGINF 0xC0C0C0C0 #define LINF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(), v.end() #define NULO -1 #define EPS 1e-10 #define PI 2 * acos(0) #define pb push_back #define mp make_pair #define pq priority_queue #define LSONE(s) ((s)&(-s)) #define F first #define S second inline int cmp(double x, double y = 0, double tol = EPS) { return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1; } int main() { int n; scanf("%d", &n); map horizontal, vertical; int x, y; for(int i = 0; i < n; i++) { scanf("%d %d", &x, &y); horizontal[x]++; vertical[y]++; } printf("%s\n", horizontal.size() == 1 || vertical.size() == 1 ? "YES" : "NO"); return 0; }