#include //#include using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n) - 1; i >= 0; --i) #define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } bool query(vector&v) { cout << "?" << " "; for (auto e : v)cout << e + 1 << " "; cout << endl; string s; cin >> s; return s == "Yes"; } template T binarySearch(T ok, T ng, const F &f) { while (abs(ok - ng) > 1) { T mid = (ok + ng) / 2; (f(mid) ? ok : ng) = mid; } return ok; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin >> n; vector to(n, vector()); vector

e(n - 1); rep(i, n - 1) { int u, v; cin >> u >> v; u--, v--; to[u].push_back(v); to[v].push_back(u); e[i] = { u,v }; } vectorcol(n, 0); auto dfs = [&](auto &&self, int v, int p = -1)->void { for (auto nv : to[v]) { if (p == nv)continue; col[nv] = 1 - col[v]; self(self, nv, v); } }; dfs(dfs, 0); vectorv(n - 1); rep(i, n - 1) { if (col[e[i].first] == 0)v[i] = e[i].first; else v[i] = e[i].second; } auto q0 = query(v); if (!q0) { rep(i, n)col[i] = 1 - col[i]; }// 0にあるのは確定した { setst;//used0 vectoruse0(n); rep(i, n - 1) { int x = e[i].first, y = e[i].second;// 01 if (col[e[i].first] == 1)swap(x, y); if (use0[x]) x = y; else use0[x] = true;; e[i] = { x,y }; } } auto f = [&](const long long x)->bool { vectorv(n - 1); rep(i, n - 1) { if (i <= x) v[i] = e[i].first; else v[i] = e[i].second; } return query(v); }; auto index = binarySearch(n - 1, -1, f); int ans = e[index].first; cout << "! " << ans + 1 << endl; return 0; }