#include #include #include #include #include using namespace std; std::vector> ps; void Precalc() { } void Solve() { int n; cin >> n; ps.resize(n); for(auto &p: ps) cin >> p.first >> p.second; if(std::all_of(ps.begin(), ps.end(), [x=ps.front().first](auto &p) { return p.first==x; })|| std::all_of(ps.begin(), ps.end(), [y=ps.front().second](auto &p) { return p.second==y; })) { printf("YES"); return; } printf("NO"); } int main() { int t=1; // cin >> t; Precalc(); for(int tc=1; tc<=t; ++tc) { Solve(); } }