#include #include bool query(int i, int x, int j, int y) { std::cout << "? " << i << ' ' << x << ' ' << j << ' ' << y << '\n', std::cout.flush(); std::string response; std::cin >> response; if (response == "Yes") { return true; } else if (response == "No") { return false; } else { assert(false); } } void output_answer(int n, int i1, int j1, int i2, int j2, int i3, int j3) { std::cout << "!"; for (int i = 0; i < n; ++i) std::cout << ' ' << i1 << ' ' << j1; for (int i = 0; i < n; ++i) std::cout << ' ' << i2 << ' ' << j2; for (int i = 0; i < n; ++i) std::cout << ' ' << i3 << ' ' << j3; std::cout << '\n', std::cout.flush(); } int main() { int n; std::cin >> n; int i3, j3, i2, j2, i1, j1; bool q1 = query(2, 2 * n, 3, 2 * n); if (q1) { bool q2 = query(1, 2 * n, 3, 2 * n); if (q2) { i3 = 1, j3 = 2; } else { i3 = 2, j3 = 3; } } else { bool q2 = query(1, 2 * n, 2, 2 * n); if (q2) { i3 = 1, j3 = 3; } else { i3 = 2, j3 = 3; } } std::cerr << i3 << ", " << j3 << std::endl; i2 = i3 ^ j3; bool q3 = query(i3, n, j3, n); if (q3) { j2 = i3; } else { j2 = j3; } i1 = i2, j1 = j2 ^ i3 ^ j3; output_answer(n, i1, j1, i2, j2, i3, j3); }