#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; scanf("%d", &n); vector > tab(n); for(int i = 0; i < n; i++) cin >> tab[i].first >> tab[i].second; bool a1 = true, a2 = true; for(int i = 0; i < n; i++) { if(tab[i].first != tab[0].first) a1 = false; if(tab[i].second != tab[0].second) a2 = false; } cout << (a1 || a2 ? "YES" : "NO"); }