#include using namespace std; using int_ = int; #define int long long int_ main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); int n; cin >> n; set xs, ys; for (int i=0; i> x >> y; xs.insert(x); ys.insert(y); } cout << ((xs.size()==1 || ys.size()==1) ? "YES" : "NO") << '\n'; } /* * Local variables: * compile-command:"g++ -D_GLIBCXX_DEBUG -g3 -ggdb3 -O0 -Wall -Wextra -std=c++14 a.cc -o a && for f in *.in; do echo \"--- $f -------------\"; ./a <$f; done" * end: */