#include #include #include #include #include using namespace std; const int minn = 6, maxn = 100; int numberOfQueries; pair ask(set &coins){ numberOfQueries++; cout << "? "; for (int x : coins) cout << x + 1 << " "; cout << endl; int x, y; cin >> x >> y; return {x - 1, y - 1}; } pair ask(set &coins, int a, int b){ numberOfQueries++; cout << "? "; for (int x : coins) cout << x + 1 << " "; cout << a + 1 << " " << b + 1 << endl; int x, y; cin >> x >> y; return {x - 1, y - 1}; } int main(){ int t; cin >> t; while (t-- > 0){ int n; cin >> n; assert(n <= maxn && n >= minn); numberOfQueries = 0; set currentCoins; vector postponedCoins; for (int i = 0; i < 5; i++) currentCoins.insert(i); int nextCoin = 5; while (nextCoin < n || currentCoins.size() > 3){ pair v = ask(currentCoins); currentCoins.erase(v.first); currentCoins.erase(v.second); postponedCoins.push_back(v.first); postponedCoins.push_back(v.second); if (nextCoin + 1 < n){ currentCoins.insert(nextCoin); currentCoins.insert(nextCoin + 1); nextCoin += 2; continue; } if (nextCoin == n - 1){ currentCoins.insert(nextCoin); currentCoins.insert(postponedCoins.back()); postponedCoins.pop_back(); nextCoin++; continue; } } assert(postponedCoins.size() == n - 3); assert(currentCoins.size() == 3); vector s; for (int x : currentCoins) s.push_back(x); currentCoins.clear(); for (int i = 0; i < 3; i++) currentCoins.insert(postponedCoins[i]); map > cnt; pair v; v = ask(currentCoins, s[0], s[1]); for (int x : currentCoins){ if (x != v.first && x != v.second) cnt[x].push_back(s[2]); } v = ask(currentCoins, s[0], s[2]); for (int x : currentCoins){ if (x != v.first && x != v.second) cnt[x].push_back(s[1]); } v = ask(currentCoins, s[1], s[2]); for (int x : currentCoins){ if (x != v.first && x != v.second) cnt[x].push_back(s[0]); } int numberOfCandidates = 0; for (int x : currentCoins){ if (cnt[x].size() == 1){ cout << "! " << cnt[x][0] + 1 << endl; numberOfCandidates++; } } assert(numberOfCandidates == 1); assert(numberOfQueries <= n / 2 + 2); } return 0; }