#include #include #include #include #include #include #include using namespace std; int main() { int number_of_queries, num_points_current_query, curr_x, curr_y, temp, no_set; set x_coords, y_coords; string input_pair; cin >> number_of_queries; for (int a = 0; a < number_of_queries; a++) { cin >> num_points_current_query; if (num_points_current_query < 4) { cout << "YES" << endl; for (int c = 0; c < num_points_current_query; c++) { cin >> temp; cin >> temp; } continue; } else { for (int b = 0; b < num_points_current_query; b++) { no_set = 0; cin >> curr_x; cin >> curr_y; if (b < 3) { x_coords.insert(curr_x); y_coords.insert(curr_y); } else { if (x_coords.count(curr_x) == 0 && y_coords.count(curr_y) == 0) { cout << "NO" << endl; no_set = 1; break; } } } if (no_set == 0) { cout << "YES" << endl; } } } return 0; }