#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <queue>
#include <cassert>
#include <map>
#include <string>	
#include <iomanip>
#include <set>
#include <ctime>
using namespace std;

#define FOR(i, n) for (int i = 0; i < (int)(n); ++i)
#define pb push_back
#define sz(v) (int)(v).size()
#define mp make_pair	
#define all(v) (v).begin(), (v).end()
//typedef long double LD;
typedef long long LL;

void solve() {
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	FOR(i, n) cin >> x[i] >> y[i];
	bool ok1 = true;
	FOR(i, n) ok1 &= (x[i] == x[0]);
	bool ok2 = true;
	FOR(i, n) ok2 &= (y[i] == y[0]);
	if (ok1 || ok2) puts("YES");
	else puts("NO");
}

void testgen() {
    FILE *f = fopen("input.txt", "w");
    srand(time(0));
    fclose(f);
}

int main() {
#ifdef harhro94
    //testgen();
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#else
    #define task "dream"
    //freopen(task".in", "r", stdin);
    //freopen(task".out", "w", stdout);
#endif

    solve();

#ifdef harhro94
    cerr << "\ntime = " << fixed << setprecision(3) << clock() / (double)CLOCKS_PER_SEC << "s\n";
#endif
    return 0;
}