#include #include #define FOR(i, min, max) for (int i = (min); i < (max); ++i) #define FORE(i, min, max) for (int i = (min); i <= (max); ++i) #define DFOR(i,max,min) for(int i=(max);i>(min);--i) #define DFORE(i,max,min) for(int i=(max);i>=(min);--i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define DREP(i, n) for (int i = (n); i >=0; --i) #define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) #define FOR_EACH(vec, it) for (auto it = (vec).begin(); it != (vec).end(); ++it) #define LL long long int using namespace std; namespace std { template class hash> { public: size_t operator()(const std::pair& x) const{ return hash()(x.first) ^ hash()(x.second); } }; } class Clock{ public: double startTime; double getTime(){ timeval tv; gettimeofday(&tv,NULL); return tv.tv_sec+tv.tv_usec*1e-6; } void start(){ startTime=getTime(); } double now(){ return getTime()-startTime; } }; vector split(const string &str, char delim=' '){ vector res; size_t current = 0, found; while((found = str.find_first_of(delim, current)) != string::npos){ res.push_back(string(str, current, found - current)); current = found + 1; } res.push_back(string(str, current, str.size() - current)); return res; } template string join(vector ss,string d=" "){ ostringstream os; for(int i=0;i it(cin); istreambuf_iterator last; string str(it, last); return str; } int readInt(){ int n; cin >> n; return n; } template string str(const Ret& n){ ostringstream os; os << n; return os.str(); } //use readVector(int n) template vector readVector(int n){ vector v(n); REP(i,n){ cin >> v[i]; } return v; } vector readInts(int n){ string s; getline(cin,s); vector ss=split(s); vector v(n); REP(i,n){ v[i]=atoi(ss[i].c_str()); } return v; } int main(){ int n; cin >> n; set xs; set ys; REP(i,n){ int x,y; cin >> x >> y; xs.insert(x); ys.insert(y); } if(xs.size()==1||ys.size()==1){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }