#include #include #include #include #include int main() { constexpr int kMaxN = 100; int n; std::cin >> n; assert(1 <= n && n <= kMaxN); const auto Query = [n](const int i, const int x, const int j, const int y) -> bool { assert(1 <= i && i <= 3 && 1 <= x && x <= n * 2 && 1 <= j && j <= 3 && 1 <= y && y <= n * 2); std::cout << "? " << i << ' ' << x << ' ' << j << ' ' << y << std::endl; std::string answer; std::cin >> answer; assert(answer == "Yes" || answer == "No"); return answer == "Yes"; }; int largest_deck = 1; // V_{i, 2n} が一番大きな山札 for (int i = 2; i <= 3; ++i) { if (Query(largest_deck, n * 2, i, n * 2)) largest_deck = i; } int smaller_deck = 0; // V_{i, n} が小さい方の山札 for (int i = 1; i <= 3; ++i) { if (i == largest_deck) continue; for (int j = i + 1; j <= 3; ++j) { if (j != largest_deck) { smaller_deck = (Query(i, n, j, n) ? i : j); break; } } } assert(1 <= smaller_deck && smaller_deck <= 3); // ゲームを行う const int another_deck = largest_deck ^ smaller_deck; std::cout << '!'; for (const auto& [i, j] : std::array, 3>{ std::make_pair(largest_deck, another_deck), std::make_pair(largest_deck, smaller_deck), std::make_pair(another_deck, smaller_deck)}) { assert(i != j); for (int turn = 1; turn <= n; ++turn) { std::cout << ' ' << i << ' ' << j; } } std::cout << std::endl; return 0; }