#include using namespace std; int main() { int n; cin >> n; bool x_eq = true, y_eq = true; int x_prev = -11, y_prev = -11; for ( int i = 0, x, y ; i < n ; ++ i ) { cin >> x >> y; if ( x_prev != -11 ) x_eq = x_eq && ( x == x_prev ); if ( y_prev != -11 ) y_eq = y_eq && ( y == y_prev ); x_prev = x, y_prev = y; } cout << ( ( x_eq || y_eq ) ? "YES" : "NO" ) << endl; return 0; }