#include using namespace std; int query(int l, int r, int L, int R) { cout << "? " << l << " " << r << " " << L << " " << R << endl; int X; cin >> X; return X; } void answer(int l, int r, int L, int R) { cout << "! " << l << " " << r << " " << L << " " << R << endl; } int main() { int N, Q; cin >> N >> Q; vector smaller; vector larger; for (int i = 1; i <= N; i++) { int X = query(i, N, i + 1, N); if (X == 1) { smaller.push_back(i); larger.push_back(i + 1); } else if (X == 0) { larger.push_back(i); smaller.push_back(i + 1); } else { return 0; } } int smallest = smaller[0]; for (int i = 1; i < smaller.size(); i++) { int X = query(smaller[i], smaller[i], smallest, smallest); if (X == 1) { smallest = smaller[i]; } else if (X == 0) { // pass } else { return 0; } } int largest = larger[0]; for (int i = 1; i < larger.size(); i++) { int X = query(largest, N, larger[i], N); if (X == 1) { largest = larger[i]; } else if (X == 0) { // pass } else { return 0; } } answer(smallest, largest, smallest, largest); }