#include #include using namespace std; const int nmax = 15; int n; pair p[nmax]; int main() { scanf("%i", &n); for (int i = 1; i <= n; ++ i) scanf("%i %i", &p[i].first, &p[i].second); sort(p + 1, p + n + 1); if (p[1].first == p[n].first) return 0 * printf("YES"); for (int i = 1; i <= n; ++ i) swap(p[i].first, p[i].second); sort(p + 1, p + n + 1); if (p[1].first == p[n].first) return 0 * printf("YES"); printf("NO"); }