/* |\ | `|` |``\ ```|` | | /```\ |``\ | \ | | |__/ | |___| | | |__/ | \ | | | \ | | | | | | \ _| \| _|_ | \ \__) | | \___/ | \ */ #include using namespace std; int n; set X, Y; int main (int argc, char const *argv[]) { scanf("%d", &n); while (n--) { int x, y; scanf("%d %d", &x, &y); X.insert(x), Y.insert(y); } if (X.size() == 1 or Y.size() == 1) printf("YES\n"); else printf("NO\n"); return 0; }