#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int n; cin >> n; int *x_coords; int *y_coords; x_coords = new int[n]; y_coords = new int[n]; for(int a0 = 0; a0 < n; a0++){ int x; int y; cin >> x >> y; x_coords[a0] = x; y_coords[a0] = y; } int flag = -1; //1 - vert 2-horiz int horiz_flag = 0; int vert_flag = 0; for ( int i = 0; i < n; i++) { if ( flag == -1 ) { horiz_flag = x_coords[i]; vert_flag = y_coords[i]; flag = 0; }; if ( flag == 0 ) { if ( x_coords[i] != horiz_flag && y_coords[i] != vert_flag ) { cout << "NO"; return 1; } if ( x_coords[i] != horiz_flag ) { flag = 1; }; if ( y_coords[i] != vert_flag ) { flag = 2; } } if ( flag == 1 && y_coords[i] != vert_flag ) { cout << "NO"; return 1; } if ( flag == 2 && x_coords[i] != horiz_flag ) { cout << "NO"; return 1; } } cout << "YES"; return 0; }