// https://github.com/edon8618/mylib // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2") #include using namespace std; #include using namespace atcoder; // #include // using namespace boost::multiprecision; #define ll long long #define ld long double #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define vi vector #define vl vector #define vd vector // #define vb vector #define vs vector #define vc vector #define ull unsigned long long #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() template inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; } // #define ll int // #define ll int128_t // #define ll int256_t // #define ll cpp_int constexpr ll inf = (1ll << 61); // constexpr ll inf = (1 << 30); // const double PI=3.1415926535897932384626433832795028841971; uint32_t xor_x = 123456789, xor_y = 362436069, xor_z = 521288629, xor_w = 88675123; inline uint32_t xor_next() { uint32_t t = xor_x ^ (xor_x << 11); xor_x = xor_y; xor_y = xor_z; xor_z = xor_w; return xor_w = (xor_w ^ (xor_w >> 19)) ^ (t ^ (t >> 8)); } inline int rnd(int max_val) { return xor_next() % max_val; } struct Timer { std::chrono::steady_clock::time_point start_time; Timer() { reset(); } // 測定の起点リセット用 void reset() { start_time = std::chrono::steady_clock::now(); } // スタートからの経過時間をミリ秒(msec)で返す long long get_ms() const { auto now = std::chrono::steady_clock::now(); return std::chrono::duration_cast(now - start_time).count(); } }; struct I128Hash { size_t operator()(__int128_t a) const { uint64_t x = (uint64_t)a ^ (uint64_t)((__uint128_t)a>>64); x ^= x >> 30; x *= 0xbf58476d1ce4e5b9ULL; x ^= x >> 27; x *= 0x94d049bb133111ebULL; return x ^ (x >> 31); } }; // vl fact; // ll kai(ll n){ // fact.resize(n,1); // rep(i,n-1)fact[i+1]=fact[i]*(i+1); // } // using mint = ld; using mint = modint998244353;//static_modint<998244353> // using mint = modint1000000007;//static_modint<1000000007> // using mint = static_modint<922267487>; // 多分落とされにくい NOT ntt-friendly // using mint = static_modint<469762049>; // ntt-friendly // using mint = static_modint<167772161>; // ntt-friendly // using mint = modint;//mint::set_mod(mod); // ll const mod=1000000007ll; // ll const mod=998244353ll; // ll modrui(ll a,ll b,ll mod){ // a%=mod; // if(b==0)return 1; // if(b%2==1) return a*modrui(a*a%mod,b/2,mod)%mod; // return modrui(a*a%mod,b/2,mod)%mod; // } // void incr(vl &v,ll n){// n進法 // ll k=v.size(); // v[k-1]++; // ll now=k-1; // while (v[now]>=n) // { // v[now]=0; // if(now==0)break; // v[now-1]++; // now--; // } // return; // } vector fact,invf; void init_modfact(ll sz){ fact.resize(sz); invf.resize(sz); fact[0]=1; rep(i,sz-1){ fact[i+1]=fact[i]*(i+1); } invf[sz-1]=1/fact[sz-1]; for(ll i=sz-2; i>=0; i--){ invf[i]=invf[i+1]*(i+1); } } mint choose(ll n,ll r){ if(n modpow,invpow; // void init_modpow(ll x,ll sz){ // mint inv=1/mint(x); // modpow.assign(sz,1); // invpow.assign(sz,1); // rep(i,sz-1){ // modpow[i+1]=modpow[i]*x; // invpow[i+1]=invpow[i]*inv; // } // } // long long phi(long long n) {// O(sqrt(n)) // long long res = n; // for (long long i = 2; i * i <= n; i++) { // if (n % i == 0) { // res -= res / i; // while (n % i == 0) n /= i; // } // } // if (n > 1) res -= res / n; // return res; // } bool dbg=0; vl ans; ll n,k; ll intr(vl const&v){ if(v.size()!=k*2){ cerr << "wrong size" << endl; assert(false); return -1; } if(dbg){ cout << "? "; rep(i,k*2){ cout << v[i] << " "; } cout << endl; vector> b(k*2); rep(i,k*2)b[i]={ans[v[i]],v[i]}; sort(all(b)); cout << b[k-1].second << endl; return b[k-1].second; } else{ cout << "? "; rep(i,k*2){ cout << v[i]+1 << " "; } cout << endl; ll t; cin >> t; return t-1; } } string judge(vl v){ if(v.size()!=k){ return "wrong ans size"; } sort(all(v)); rep(i,k){ if(ans[v[i]]>=k){ return "wrong ans"; } } rep(i,k-1){ if(v[i]==v[i+1]){ return "dup ans"; } } return "accepted"; } void solve(){ cin >> n>> k; if(dbg){ ans.resize(n); rep(i,n){ ans[i]=i; } shuffle(all(ans),mt19937(64)); rep(i,n){ cout << ans[i] << " "; } cout << endl; } vl mn,mx; ll p=-1,q=-1; { rep(i,k*2+1){ vl v; rep(j,k*2+1){ if(i!=j)v.push_back(j); } ll t=intr(v); if(p==-1 || p==t){ mn.push_back(i); p=t; } else{ mx.push_back(i); q=t; } } if(mn.size()>mx.size()){ swap(mn,mx); swap(p,q); } if(dbg){ cout << "p q = " << p << " " << q << endl; cout << "init_mn : "; rep(i,k)cout << mn[i] << " \n"[i==k-1]; cout << "init_mx : "; rep(i,k)cout << mx[i] << " \n"[i==k-1]; } } { for(ll i=k*2+1;i> t; while (t--){ solve(); // cout << flush; } }