#include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; void solve() { int n; cin >> n; vector u(n - 1), v(n - 1); rep(i, 0, n - 1) cin >> u[i] >> v[i], u[i]--, v[i]--; vector> g(n); rep(i, 0, n) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } vector dist(n, 0); { auto dfs = [&](auto self, int nw, int pr) -> void { for (int nx : g[nw]) { if (nx == pr) continue; dist[nx] = dist[nw] + 1; self(self, nx, nw); } }; dfs(dfs, 0, -1); } rep(i, 0, n - 1) { if (dist[u[i]] & 1) swap(u[i], v[i]); } { cout << "?"; rep(i, 0, n - 1) cout << " " << v[i] + 1; cout << endl; string s; cin >> s; assert(s != "Invalid"); if (s == "Yes") swap(u, v); } int up = n; int dw = 0; while (up - dw > 1) { int md = (up + dw) / 2; cout << "?"; rep(i, 0, n - 1) { cout << " "; if (u[i] < md) cout << u[i] + 1; else cout << v[i] + 1; } cout << endl; string s; cin >> s; assert(s != "Invalid"); if (s == "Yes") up = md; else dw = md; } cout << "! " << up << endl; } int main() { int t = 1; // cin >> t; while (t--) solve(); }