#include <bits/stdc++.h>
using namespace std;
#define mid ((l + r) >> 1)

const int N = 1e3 + 5;
int t, n;
int edg, head[N], to[N << 1], nxt[N << 1];
vector<int> q, S[N];
set<int> L;
int rt, len, u, d, s, h, dep[N], far[N];
char ret[15];

void solve(void);
void add_edge(int u, int v);
void query(const vector<int> &a, int &u, int &d);
void dfs(int u, int f = 0);
bool check(int x);

int main(void) {
    scanf("%d", &t);
    while (t--) solve();
    return 0;
}

void solve(void) {
    scanf("%d", &n), edg = 1, q.clear(), L.clear();
    for (int i = 1, u, v; i < n; i++)
        scanf("%d%d", &u, &v), add_edge(u, v), q.push_back(i);
    q.push_back(n), query(q, rt, len);
    for (int i = 0; i <= n; i++) S[i].clear();
    dep[0] = -1, dfs(rt);
    int l = (len + 1) / 2, r = len;
    while (l <= r) check(mid) ? l = mid + 1, h = u : r = mid - 1;
    for (int u = h; u ^ rt; u = far[u]) L.insert(u);
    q.clear(), d = len - dep[h];
    for (int x : S[d]) L.find(x) == L.end() ? q.push_back(x) : void();
    query(q, s, d), printf("! %d %d\n", s, h);
    fflush(stdout), scanf("%s", ret + 1), assert(ret[1] == 'C');
}

inline void add_edge(int u, int v) {
    to[++edg] = v, nxt[edg] = head[u], head[u] = edg;
    to[++edg] = u, nxt[edg] = head[v], head[v] = edg;
}

void query(const vector<int> &a, int &u, int &d) {
    printf("? %d", a.size());
    for (int x : a) printf(" %d", x);
    putchar('\n'), fflush(stdout), scanf("%d%d", &u, &d);
}

void dfs(int u, int f) {
    dep[u] = dep[f] + 1, far[u] = f, S[dep[u]].push_back(u);
    for (int i = head[u]; i; i = nxt[i]) {
        int v = to[i];
        if (v ^ f) dfs(v, u);
    }
}

inline bool check(int k) {
    query(S[k], u, d);
    return d == len;
}


#include <bits/stdc++.h>
using namespace std;
#define mid ((l + r) >> 1)

const int N = 1e3 + 5;
int t, n;
int edg, head[N], to[N << 1], nxt[N << 1];
vector<int> q, S[N];
set<int> L;
int rt, len, u, d, s, h, dep[N], far[N];
char ret[15];

void solve(void);
void add_edge(int u, int v);
void query(const vector<int> &a, int &u, int &d);
void dfs(int u, int f = 0);
bool check(int x);

int main(void) {
    scanf("%d", &t);
    while (t--) solve();
    return 0;
}

void solve(void) {
    scanf("%d", &n), edg = 1, q.clear(), L.clear();
    for (int i = 1, u, v; i < n; i++)
        scanf("%d%d", &u, &v), add_edge(u, v), q.push_back(i);
    q.push_back(n), query(q, rt, len);
    for (int i = 0; i < n; i++) S[i].clear();
    dep[0] = -1, dfs(rt);
    int l = (len + 1) / 2, r = len;
    while (l < r) check(mid) ? l = mid + 1, h = u : r = mid - 1;
    for (int u = h; u ^ rt; u = far[u]) L.insert(u);
    q.clear(), d = len - dep[h];
    for (int x : S[d]) L.find(x) == L.end() ? q.push_back(x) : void();
    query(q, s, d), printf("! %d %d\n", s, h), scanf("%s", ret + 1);
}

inline void add_edge(int u, int v) {
    to[++edg] = v, nxt[edg] = head[u], head[u] = edg;
    to[++edg] = u, nxt[edg] = head[v], head[v] = edg;
}

void query(const vector<int> &a, int &u, int &d) {
    printf("? %d", a.size());
    for (int x : a) printf(" %d", x);
    putchar('\n'), fflush(stdout), scanf("%d%d", &u, &d);
}

void dfs(int u, int f) {
    dep[u] = dep[f] + 1, far[u] = f, S[dep[u]].push_back(u);
    for (int i = head[u]; i; i = nxt[i]) {
        int v = to[i];
        if (v ^ f) dfs(v, u);
    }
}

inline bool check(int k) {
    query(S[k], u, d);
    return d == len;
}


#include <bits/stdc++.h>
using namespace std;
#define mid ((l + r) >> 1)

const int N = 1e3 + 5;
int t, n;
int edg, head[N], to[N << 1], nxt[N << 1];
vector<int> q, S[N];
set<int> L;
int rt, len, u, d, s, h, dep[N], far[N];
char ret[15];

void solve(void);
void add_edge(int u, int v);
void query(const vector<int> &a, int &u, int &d);
void dfs(int u, int f = 0);
bool check(int x);

int main(void) {
    scanf("%d", &t);
    while (t--) solve();
    return 0;
}

void solve(void) {
    scanf("%d", &n), edg = 1, q.clear(), L.clear();
    for (int i = 1, u, v; i < n; i++)
        scanf("%d%d", &u, &v), add_edge(u, v), q.push_back(i);
    q.push_back(n), query(q, rt, len);
    for (int i = 0; i < n; i++) S[i].clear();
    dep[0] = -1, dfs(rt);
    int l = (len + 1) / 2, r = len;
    while (l < r) check(mid) ? l = mid + 1, h = u : r = mid - 1;
    for (int u = h; u ^ rt; u = far[u]) L.insert(u);
    q.clear(), d = len - dep[h];
    for (int x : S[d]) L.find(x) == L.end() ? q.push_back(x) : void();
    query(q, s, d), printf("! %d %d\n", s, h);
    fflush(stdout), scanf("%s", ret + 1), assert(ret[1] == 'C');
}

inline void add_edge(int u, int v) {
    to[++edg] = v, nxt[edg] = head[u], head[u] = edg;
    to[++edg] = u, nxt[edg] = head[v], head[v] = edg;
}

void query(const vector<int> &a, int &u, int &d) {
    printf("? %d", a.size());
    for (int x : a) printf(" %d", x);
    putchar('\n'), fflush(stdout), scanf("%d%d", &u, &d);
}

void dfs(int u, int f) {
    dep[u] = dep[f] + 1, far[u] = f, S[dep[u]].push_back(u);
    for (int i = head[u]; i; i = nxt[i]) {
        int v = to[i];
        if (v ^ f) dfs(v, u);
    }
}

inline bool check(int k) {
    query(S[k], u, d);
    return d == len;
}


#include <bits/stdc++.h>
using namespace std;
#define mid ((l + r) >> 1)

const int N = 1e3 + 5;
int t, n;
int edg, head[N], to[N << 1], nxt[N << 1];
vector<int> q, S[N];
set<int> L;
int rt, len, u, d, s, h, dep[N], far[N];

void solve(void);
void add_edge(int u, int v);
void query(const vector<int> &a, int &u, int &d);
void dfs(int u, int f = 0);
bool check(int x);

int main(void) {
    scanf("%d", &t);
    while (t--) solve();
    return 0;
}

void solve(void) {
    scanf("%d", &n), edg = 1, q.clear(), L.clear();
    for (int i = 1, u, v; i < n; i++)
        scanf("%d%d", &u, &v), add_edge(u, v), q.push_back(i);
    q.push_back(n), query(q, rt, len);
    for (int i = 0; i < n; i++) S[i].clear();
    dep[0] = -1, dfs(rt);
    int l = len / 2, r = len;
    while (l < r) check(mid) ? l = mid + 1, h = u : r = mid - 1;
    for (int u = h; u ^ rt; u = far[u]) L.insert(u);
    q.clear(), d = len - dep[h];
    for (int x : S[d]) L.find(x) == L.end() ? q.push_back(x) : void();
    query(q, s, d), printf("! %d %d\n", s, h);
}

inline void add_edge(int u, int v) {
    to[++edg] = v, nxt[edg] = head[u], head[u] = edg;
    to[++edg] = u, nxt[edg] = head[v], head[v] = edg;
}

void query(const vector<int> &a, int &u, int &d) {
    printf("? %d", a.size());
    for (int x : a) printf(" %d", x);
    putchar('\n'), fflush(stdout), scanf("%d%d", &u, &d);
}

void dfs(int u, int f) {
    dep[u] = dep[f] + 1, far[u] = f, S[dep[u]].push_back(u);
    for (int i = head[u]; i; i = nxt[i]) {
        int v = to[i];
        if (v ^ f) dfs(v, u);
    }
}

inline bool check(int k) {
    query(S[k], u, d);
    return d == len;
}


#include <bits/stdc++.h>
using namespace std;
#define mid ((l + r) >> 1)

const int N = 1e3 + 5;
int t, n;
int edg, head[N], to[N << 1], nxt[N << 1];
vector<int> q, S[N];
set<int> L;
int rt, len, u, d, s, h, dep[N], far[N];
char ret[15];

void solve(void);
void add_edge(int u, int v);
void query(const vector<int> &a, int &u, int &d);
void dfs(int u, int f = 0);
bool check(int x);

int main(void) {
    scanf("%d", &t);
    while (t--) solve();
    return 0;
}

void solve(void) {
    scanf("%d", &n), q.clear(), L.clear();
    edg = 1, memset(head, 0, (n + 1) * sizeof(int));
    for (int i = 1, u, v; i < n; i++)
        scanf("%d%d", &u, &v), add_edge(u, v), q.push_back(i);
    q.push_back(n), query(q, rt, len);
    for (int i = 0; i <= n; i++) S[i].clear();
    dep[0] = -1, dfs(rt);
    int l = (len + 1) / 2, r = len;
    while (l <= r) check(mid) ? l = mid + 1, h = u : r = mid - 1;
    for (int u = h; u ^ rt; u = far[u]) L.insert(u);
    q.clear(), d = len - dep[h];
    for (int x : S[d]) L.find(x) == L.end() ? q.push_back(x) : void();
    query(q, s, d), printf("! %d %d\n", s, h);
    fflush(stdout), scanf("%s", ret + 1);
}

inline void add_edge(int u, int v) {
    to[++edg] = v, nxt[edg] = head[u], head[u] = edg;
    to[++edg] = u, nxt[edg] = head[v], head[v] = edg;
}

void query(const vector<int> &a, int &u, int &d) {
    printf("? %d", a.size());
    for (int x : a) printf(" %d", x);
    putchar('\n'), fflush(stdout), scanf("%d%d", &u, &d);
}

void dfs(int u, int f) {
    dep[u] = dep[f] + 1, far[u] = f, S[dep[u]].push_back(u);
    for (int i = head[u]; i; i = nxt[i]) {
        int v = to[i];
        if (v ^ f) dfs(v, u);
    }
}

inline bool check(int k) {
    query(S[k], u, d);
    return d == len;
}


#include <bits/stdc++.h>
using namespace std;
#define mid ((l + r) >> 1)

const int N = 1e3 + 5;
int t, n;
int edg, head[N], to[N << 1], nxt[N << 1];
vector<int> q, S[N];
set<int> L;
int rt, len, u, d, s, h, dep[N], far[N];
char ret[15];

void solve(void);
void add_edge(int u, int v);
void query(const vector<int> &a, int &u, int &d);
void dfs(int u, int f = 0);
bool check(int x);

int main(void) {
    scanf("%d", &t);
    while (t--) solve();
    return 0;
}

void solve(void) {
    scanf("%d", &n), q.clear(), L.clear();
    edg = 1, memset(head, 0, (n + 1) * sizeof(int));
    for (int i = 1, u, v; i < n; i++)
        scanf("%d%d", &u, &v), add_edge(u, v), q.push_back(i);
    q.push_back(n), query(q, rt, len);
    for (int i = 0; i <= n; i++) S[i].clear();
    dep[0] = -1, dfs(rt);
    int l = (len + 1) / 2, r = len;
    while (l <= r) check(mid) ? l = mid + 1, h = u : r = mid - 1;
    for (int u = h; u ^ rt; u = far[u]) L.insert(u);
    q.clear(), d = len - dep[h];
    for (int x : S[d]) L.find(x) == L.end() ? q.push_back(x) : void();
    query(q, s, d), printf("! %d %d\n", s, h);
    fflush(stdout), scanf("%s", ret + 1);
}

inline void add_edge(int u, int v) {
    to[++edg] = v, nxt[edg] = head[u], head[u] = edg;
    to[++edg] = u, nxt[edg] = head[v], head[v] = edg;
}

void query(const vector<int> &a, int &u, int &d) {
    printf("? %d", a.size());
    for (int x : a) printf(" %d", x);
    putchar('\n'), fflush(stdout), scanf("%d%d", &u, &d);
}

void dfs(int u, int f) {
    dep[u] = dep[f] + 1, far[u] = f, S[dep[u]].push_back(u);
    for (int i = head[u]; i; i = nxt[i]) {
        int v = to[i];
        if (v ^ f) dfs(v, u);
    }
}

inline bool check(int k) {
    return !S[k].empty() ? query(S[k], u, d), d == len : false;
}


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define sci(a) scanf("%d",&(a))
const int N=1e3+10;
typedef pair<int,int> P;
vector<int>e[N],dep[N],now;
char s[20];
int t,n,u,v,dis,mx;
P tmp,las;
P ask(vector<int> &x){
    printf("? %d",(int)x.size());
    for(int v:x){
        printf(" %d",v);
    }
    printf("\n");
    fflush(stdout);
    P ans;
    scanf("%d%d",&ans.fi,&ans.se);
    return ans;
}
void dfs(int u,int fa,int y){
    dep[y].pb(u);
    mx=max(mx,y);
    for(int v:e[u]){
        if(v==fa)continue;
        dfs(v,u,y+1);
    }
}
int main(){
    sci(t);
    while(t--){
        sci(n);
        now.clear();
        rep(i,0,n){
            dep[i].clear();
            e[i].clear();
            if(i)now.pb(i);
        }
        rep(i,2,n){
            sci(u),sci(v);
            e[u].pb(v);
            e[v].pb(u);
        }
        tmp=ask(now);
        u=tmp.fi,dis=tmp.se;
        mx=0;
        dfs(u,-1,0);
        int l=(dis+1)/2,r=min(dis,mx);//dis/2向上取整 绝了 减少了一次二分 找远端节点
        //printf("u:%d dis:%d l:%d r:%d\n",u,dis,l,r);
        while(l<=r){//找到最大的深度满足==dis的节点
            int mid=(l+r)/2;
            tmp=ask(dep[mid]);
            if(tmp.se==dis)l=mid+1,u=tmp.fi;
            else r=mid-1;
        }
        rep(i,0,n){
            dep[i].clear();
        }
        dfs(u,-1,0);
        tmp=ask(dep[dis]);
        v=tmp.fi;
        printf("! %d %d\n",u,v);
        fflush(stdout);
        scanf("%s",s);
        if(strcmp(s,"Correct")==0){
            continue;
        }
    }
    return 0;

/*
————————————————
版权声明：本文为CSDN博主「Code92007」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
原文链接：https://blog.csdn.net/Code92007/java/article/details/106884213
*/


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define sci(a) scanf("%d",&(a))
const int N=1e3+10;
typedef pair<int,int> P;
vector<int>e[N],dep[N],now;
char s[20];
int t,n,u,v,dis,mx;
P tmp,las;
P ask(vector<int> &x){
    printf("? %d",(int)x.size());
    for(int v:x){
        printf(" %d",v);
    }
    printf("\n");
    fflush(stdout);
    P ans;
    scanf("%d%d",&ans.fi,&ans.se);
    return ans;
}
void dfs(int u,int fa,int y){
    dep[y].pb(u);
    mx=max(mx,y);
    for(int v:e[u]){
        if(v==fa)continue;
        dfs(v,u,y+1);
    }
}
int main(){
    sci(t);
    while(t--){
        sci(n);
        now.clear();
        rep(i,0,n){
            dep[i].clear();
            e[i].clear();
            if(i)now.pb(i);
        }
        rep(i,2,n){
            sci(u),sci(v);
            e[u].pb(v);
            e[v].pb(u);
        }
        tmp=ask(now);
        u=tmp.fi,dis=tmp.se;
        mx=0;
        dfs(u,-1,0);
        int l=(dis+1)/2,r=min(dis,mx);//dis/2向上取整 绝了 减少了一次二分 找远端节点
        //printf("u:%d dis:%d l:%d r:%d\n",u,dis,l,r);
        while(l<=r){//找到最大的深度满足==dis的节点
            int mid=(l+r)/2;
            tmp=ask(dep[mid]);
            if(tmp.se==dis)l=mid+1,u=tmp.fi;
            else r=mid-1;
        }
        rep(i,0,n){
            dep[i].clear();
        }
        dfs(u,-1,0);
        tmp=ask(dep[dis]);
        v=tmp.fi;
        printf("! %d %d\n",u,v);
        fflush(stdout);
        scanf("%s",s);
        if(strcmp(s,"Correct")==0){
            continue;
        }
    }
    return 0;
}
/*
————————————————
版权声明：本文为CSDN博主「Code92007」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
原文链接：https://blog.csdn.net/Code92007/java/article/details/106884213
*/


#include <bits/stdc++.h>
using namespace std;
const int maxn=1100;
typedef long long ll;
vector <int> d[maxn],g[maxn];
int vis[maxn],vis2[maxn],fa[maxn];
void dfs(int x,int ff,int dep)
{
    int v;
    fa[x]=ff;
    d[dep].push_back(x); vis[x]=1;
    for (int i=0;i<g[x].size();i++) {
        v=g[x][i];
        if (vis[v]) continue ;
        dfs(v,x,dep+1);
    }
}
int query(int dep,int &ret)
{
    int ret2,dd;
   // printf("dep=%d\n",dep);
    printf("? %d",d[dep].size());
    for (int i=0;i<d[dep].size();i++) {
        printf(" %d",d[dep][i]);
    }
    printf("\n");
    fflush(stdout);
    scanf("%d%d",&ret2,&dd);
    ret=ret2;
    return dd;
}
int main()
{
    int s,f,T,n,len,df,f2,u,v,rt,l,mid,now,d2,r;
    ///freopen("text.in","r",stdin);
    scanf("%d",&T);
    while (T--) {
        scanf("%d",&n);
        for (int i=0;i<=n;i++) {
            g[i].clear();
            d[i].clear();
            fa[i]=-1;
        }
        memset(vis,0,sizeof(vis));
        memset(vis2,0,sizeof(vis2));
        for (int i=1;i<=n-1;i++) {
            scanf("%d%d",&u,&v);
            g[u].push_back(v);
            g[v].push_back(u);
        }
        printf("? %d",n);
        for (int i=1;i<=n;i++) {
            printf(" %d",i);
        }
        printf("\n");
        fflush(stdout);
        scanf("%d%d",&rt,&len);
        dfs(rt,-1,0);
        l=(len+1)/2; r=len;
        /*for (int i=0;i<=len;i++) {
            printf("qwe=%d :\n",i);
            for (int j=0;j<d[i].size();j++) {
                printf(" %d",d[i][j]);
            }
            printf("\n");
        }*/
        while (l<=r) {
            mid=(l+r)/2;
            int ddd=query(mid,f2);
            if (ddd<=len) {
                f=f2;
                df=ddd;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        now=f;
        while (now!=-1) {
            vis2[now]=1;
            now=fa[now];
        }
        d2=len-df;
        if (d2) {
        printf("? %d",d[d2].size()-1);
        for (int i=0;i<d[d2].size();i++) {
            if (vis2[d[d2][i]]) continue ;
            printf(" %d",d[d2][i]);
        }
        printf("\n");
        fflush(stdout);
        int dd;
        scanf("%d%d",&s,&dd);
        }else {
            s=rt;
        }
        printf("! %d %d\n",s,f);
        char ss[20];
        scanf("%s",ss);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1100;
typedef long long ll;
vector <int> d[maxn],g[maxn];
int vis[maxn],vis2[maxn],fa[maxn];
void dfs(int x,int ff,int dep)
{
    int v;
    fa[x]=ff;
    d[dep].push_back(x); vis[x]=1;
    for (int i=0;i<g[x].size();i++) {
        v=g[x][i];
        if (vis[v]) continue ;
        dfs(v,x,dep+1);
    }
}
int query(int dep,int &ret)
{
    int ret2,dd;
   // printf("dep=%d\n",dep);
    printf("? %d",d[dep].size());
    for (int i=0;i<d[dep].size();i++) {
        printf(" %d",d[dep][i]);
    }
    printf("\n");
    fflush(stdout);
    scanf("%d%d",&ret2,&dd);
    ret=ret2;
    return dd;
}
int main()
{
    int s,f,T,n,len,df,f2,u,v,rt,l,mid,now,d2,r;
    ///freopen("text.in","r",stdin);
    scanf("%d",&T);
    while (T--) {
        scanf("%d",&n);
        for (int i=0;i<=n;i++) {
            g[i].clear();
            d[i].clear();
            fa[i]=-1;
        }
        memset(vis,0,sizeof(vis));
        memset(vis2,0,sizeof(vis2));
        for (int i=1;i<=n-1;i++) {
            scanf("%d%d",&u,&v);
            g[u].push_back(v);
            g[v].push_back(u);
        }
        printf("? %d",n);
        for (int i=1;i<=n;i++) {
            printf(" %d",i);
        }
        printf("\n");
        fflush(stdout);
        scanf("%d%d",&rt,&len);
        dfs(rt,-1,0);
        l=(len+1)/2; r=len;
        /*for (int i=0;i<=len;i++) {
            printf("qwe=%d :\n",i);
            for (int j=0;j<d[i].size();j++) {
                printf(" %d",d[i][j]);
            }
            printf("\n");
        }*/
        while (l<=r) {
            mid=(l+r)/2;
            int ddd=query(mid,f2);
            if (ddd<=len) {
                f=f2;
                df=ddd;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        now=f;
        while (now!=-1) {
            vis2[now]=1;
            now=fa[now];
        }
        d2=len-df;
        if (d2) {
        printf("? %d",d[d2].size()-1);
        for (int i=0;i<d[d2].size();i++) {
            if (vis2[d[d2][i]]) continue ;
            printf(" %d",d[d2][i]);
        }
        printf("\n");
        fflush(stdout);
        int dd;
        scanf("%d%d",&s,&dd);
        }else {
            s=rt;
        }
        printf("! %d %d\n",s,f);
        fflush(stdout);
        char ss[20];
        scanf("%s",ss);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1100;
typedef long long ll;
vector <int> d[maxn],g[maxn];
int vis[maxn],vis2[maxn],fa[maxn];
void dfs(int x,int ff,int dep)
{
    int v;
    fa[x]=ff;
    //printf("x=%d dep=%d\n",x,dep);
    d[dep].push_back(x); vis[x]=1;
    for (int i=0;i<g[x].size();i++) {
        v=g[x][i];
        if (vis[v]) continue ;
        dfs(v,x,dep+1);
    }
}
int query(int dep,int &ret)
{
    int ret2,dd;
  //  printf("dep=%d\n",dep);
    printf("? %d",d[dep].size());
    for (int i=0;i<d[dep].size();i++) {
        printf(" %d",d[dep][i]);
    }
    printf("\n");
    fflush(stdout);
    scanf("%d%d",&ret2,&dd);
    ret=ret2;
    return dd;
}
int main()
{
    int s,f,T,n,len,df,f2,u,v,rt,l,mid,now,d2,r;
    ///freopen("text.in","r",stdin);
    scanf("%d",&T);
    while (T--) {
        scanf("%d",&n);
        for (int i=0;i<=n;i++) {
            g[i].clear();
            d[i].clear();
            fa[i]=-1;
        }
        memset(vis,0,sizeof(vis));
        memset(vis2,0,sizeof(vis2));
        for (int i=1;i<=n-1;i++) {
            scanf("%d%d",&u,&v);
            g[u].push_back(v);
            g[v].push_back(u);
        }
        printf("? %d",n);
        for (int i=1;i<=n;i++) {
            printf(" %d",i);
        }
        printf("\n");
        fflush(stdout);
        scanf("%d%d",&rt,&len);
      //  printf("rt=%d %d\n",rt,len);
        dfs(rt,-1,0);
        l=(len+1)/2; r=len;
       /* for (int i=0;i<=len;i++) {
            printf("qwe=%d :\n",i);
            for (int j=0;j<d[i].size();j++) {
                printf(" %d",d[i][j]);
            }
            printf("\n");
        }*/
        while (l<=r) {
            mid=(l+r)/2;
            int ddd=query(mid,f2);
            if (ddd<=len) {
                f=f2;
                df=mid;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        now=f;
        while (now!=-1) {
            vis2[now]=1;
            now=fa[now];
        }
        d2=len-df;
        if (d2) {
        printf("? %d",d[d2].size()-1);
        for (int i=0;i<d[d2].size();i++) {
            if (vis2[d[d2][i]]) continue ;
            printf(" %d",d[d2][i]);
        }
        printf("\n");
        fflush(stdout);
        int dd;
        scanf("%d%d",&s,&dd);
        }else {
            s=rt;
        }
        printf("! %d %d\n",s,f);
        fflush(stdout);
        char ss[20];
        scanf("%s",ss);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1100;
typedef long long ll;
vector <int> d[maxn],g[maxn];
int vis[maxn],vis2[maxn],fa[maxn];
void dfs(int x,int ff,int dep)
{
    int v;
    fa[x]=ff;
    //printf("x=%d dep=%d\n",x,dep);
    d[dep].push_back(x); vis[x]=1;
    for (int i=0;i<g[x].size();i++) {
        v=g[x][i];
        if (vis[v]) continue ;
        dfs(v,x,dep+1);
    }
}
int query(int dep,int &ret)
{
    int ret2,dd;
   // printf("dep=%d\n",dep);
    if (d[dep].size()==0) return 2000;
    printf("? %d",d[dep].size());

    for (int i=0;i<d[dep].size();i++) {
        printf(" %d",d[dep][i]);
    }
    printf("\n");
    fflush(stdout);
    scanf("%d%d",&ret2,&dd);
    ret=ret2;
    return dd;
}
int main()
{
    int s,f,T,n,len,df,f2,u,v,rt,l,mid,now,d2,r;
  ///  freopen("text.in","r",stdin);
    scanf("%d",&T);
    while (T--) {
        scanf("%d",&n);
        for (int i=0;i<=n;i++) {
            g[i].clear();
            d[i].clear();
            fa[i]=-1;
        }
        memset(vis,0,sizeof(vis));
        memset(vis2,0,sizeof(vis2));
        for (int i=1;i<=n-1;i++) {
            scanf("%d%d",&u,&v);
            g[u].push_back(v);
            g[v].push_back(u);
        }
        printf("? %d",n);
        for (int i=1;i<=n;i++) {
            printf(" %d",i);
        }
        printf("\n");
        fflush(stdout);
        scanf("%d%d",&rt,&len);
      //  printf("rt=%d %d\n",rt,len);
        dfs(rt,-1,0);
        l=(len+1)/2; r=len;
       /* for (int i=0;i<=len;i++) {
            printf("qwe=%d :\n",i);
            for (int j=0;j<d[i].size();j++) {
                printf(" %d",d[i][j]);
            }
            printf("\n");
        }*/
        while (l<=r) {
            mid=(l+r)/2;
            int ddd=query(mid,f2);
            if (ddd<=len) {
                f=f2;
                df=mid;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        now=f;
        while (now!=-1) {
            vis2[now]=1;
            now=fa[now];
        }
        d2=len-df;
        if (d2) {

        printf("? %d",d[d2].size()-1);
        for (int i=0;i<d[d2].size();i++) {
            if (vis2[d[d2][i]]) continue ;
            printf(" %d",d[d2][i]);
        }
        printf("\n");
        fflush(stdout);
        int dd;
        scanf("%d%d",&s,&dd);
        }else {
            s=rt;
        }
        printf("! %d %d\n",s,f);
        fflush(stdout);
        char ss[20];
        scanf("%s",ss);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define pb(x) push_back(x)
#define mkp(x,y) make_pair(x,y)
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
inline int rd() {
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return x*f;
}
const int N=1005;
char s[10];
int n,dis,rt,dep[N];
int head[N],num_edge;
vector<int>v[N],vec;
struct edge {
	int nxt,to;
}e[N<<1];
inline void addedge(int fr,int to) {
	++num_edge;
	e[num_edge].to=to;
	e[num_edge].nxt=head[fr];
	head[fr]=num_edge;
}
void dfs1(int u,int ft) {
	v[dep[u]].push_back(u);
	for(int i=head[u];i;i=e[i].nxt) {
		int v=e[i].to;
		if(v==ft)continue;
		dep[v]=dep[u]+1,dfs1(v,u);
	}
}
void dfs2(int u,int ft,int d) {
	if(d==dis)return vec.push_back(u),void();
	for(int i=head[u];i;i=e[i].nxt) {
		int v=e[i].to;
		if(v==ft)continue;
		dfs2(v,u,d+1);
	}
}
void Main() {
	scanf("%d",&n);
	for(int i=1;i<=n;++i)v[i].clear();
	memset(head,0,sizeof(head)),num_edge=0;
	vec.clear();
	for(int i=1;i<n;++i) {
		int x=rd(),y=rd();
		addedge(x,y),addedge(y,x);
	}
	printf("? %d",n);for(int i=1;i<=n;++i)printf(" %d",i);puts(""),fflush(stdout);
	scanf("%d%d",&rt,&dis);
	dep[rt]=0,dfs1(rt,0);
	int l=(dis+1)>>1,r=dis,ra,rb,t;
	while(l<=r) {
		int mid=(l+r)>>1;
		if(!v[mid].size()){r=mid-1;continue;}
		printf("? %u",v[mid].size());for(int i:v[mid])printf(" %d",i);puts(""),fflush(stdout);
		scanf("%d%d",&ra,&rb);
		if(rb==dis)t=ra,l=mid+1;
		else r=mid-1;
	}
	dfs2(t,0,0);
	printf("? %u",vec.size());for(int i:vec)printf(" %d",i);puts(""),fflush(stdout);
	scanf("%d%d",&ra,&rb);
	printf("! %d %d\n",t,ra),fflush(stdout);
	scanf("%s",s);
}
signed main(){
	for(int T=rd();T;--T)Main();
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define pb(x) push_back(x)
#define mkp(x,y) make_pair(x,y)
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
inline int rd() {
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return x*f;
}
const int N=1005;
char s[10];
int n,dis,rt,dep[N],mxd;
int head[N],num_edge;
vector<int>v[N],vec;
struct edge {
	int nxt,to;
}e[N<<1];
inline void addedge(int fr,int to) {
	++num_edge;
	e[num_edge].to=to;
	e[num_edge].nxt=head[fr];
	head[fr]=num_edge;
}
void dfs1(int u,int ft) {
	v[dep[u]].push_back(u),mxd=max(dep[u],mxd);
	for(int i=head[u];i;i=e[i].nxt) {
		int v=e[i].to;
		if(v==ft)continue;
		dep[v]=dep[u]+1,dfs1(v,u);
	}
}
void dfs2(int u,int ft,int d) {
	if(d==dis)return vec.push_back(u),void();
	for(int i=head[u];i;i=e[i].nxt) {
		int v=e[i].to;
		if(v==ft)continue;
		dfs2(v,u,d+1);
	}
}
void Main() {
	scanf("%d",&n);
	for(int i=1;i<=n;++i)v[i].clear();
	memset(head,0,sizeof(head)),num_edge=0;
	vec.clear(),mxd=0;
	for(int i=1;i<n;++i) {
		int x=rd(),y=rd();
		addedge(x,y),addedge(y,x);
	}
	printf("? %d",n);for(int i=1;i<=n;++i)printf(" %d",i);puts(""),fflush(stdout);
	scanf("%d%d",&rt,&dis);
	dep[rt]=0,dfs1(rt,0);
	int l=(dis+1)>>1,r=mxd,ra,rb,t;
	while(l<=r) {
		int mid=(l+r)>>1;
		printf("? %u",v[mid].size());for(int i:v[mid])printf(" %d",i);puts(""),fflush(stdout);
		scanf("%d%d",&ra,&rb);
		if(rb==dis)t=ra,l=mid+1;
		else r=mid-1;
	}
	dfs2(t,0,0);
	printf("? %u",vec.size());for(int i:vec)printf(" %d",i);puts(""),fflush(stdout);
	scanf("%d%d",&ra,&rb);
	printf("! %d %d\n",t,ra),fflush(stdout);
	scanf("%s",s);
	if(!strcmp(s,"Incorrect"))exit(0);
}
signed main(){
	for(int T=rd();T;--T)Main();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = d + 1 >> 1, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[p.y] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 2, hi = dfs(rt);
      if(d > 2) {
         while(lo < hi) {
            int md = lo + hi + 1 >> 1;
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }

         if(!who[lo]) {
            if(dep[lo].size() > 1) {
               act.ara = dep[lo];
               who[lo] = act.query().x;
            }
            else who[lo] = dep[lo][0];
         }

         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else if(d > 1) {
         if(!dep[d].empty()) {
            act.ara = dep[d];
            p = act.query();
            if(p.y == d) {
               who[lo] = rt;
               goto done;
            }
         }
         act.ara = dep[1];
         who[lo] = act.query().x;
         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else who[lo] = rt;

      done: int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            cnt++;
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }
      if(!who[lo]) {
         if(dep[lo].size() > 1) {
assert(cnt < 11);
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz], par[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u), par[u] = p;
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = min(dfs(rt), d);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         act.ara = dep[lo];
         who[lo] = act.query().x;
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt), cnt = 1, oi = hi;
      while(lo < hi) {
         cnt++;
         if(cnt > 10) {
            cout << "! " << lo << " " << oi << endl;
            exit(0);
         }
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         cnt++;
         assert(cnt <= 11);
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         cnt++;
         if(cnt > 10) {
            cout << "? " << lo << " " << hi << endl;
            exit(0);
         }
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 1, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
            cnt++;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz], par[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u), par[u] = p;
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         for(int i=n; i; i--) if(who[i]) {
            int u = who[i];
            while(i > lo) i--, u = par[u];
            who[lo] = u;
            break;
         }
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - (p.y - d) / 2;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt);
      if(d > 2) {
         while(lo < hi) {
            int md = lo + hi + 1 >> 1;
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }

         if(!who[lo]) {
            if(dep[lo].size() > 1) {
               act.ara = dep[lo];
               who[lo] = act.query().x;
            }
            else who[lo] = dep[lo][0];
         }

         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else if(d > 1) {
         if(!dep[d].empty()) {
            act.ara = dep[d];
            p = act.query();
            if(p.y == d) {
               who[lo] = rt;
               goto done;
            }
         }
         act.ara = dep[1];
         who[lo] = act.query().x;
         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else who[lo] = rt;

      done: int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         cnt++;
         if(cnt > 10) {
            cout << "! " << lo << " " << hi << endl;
            exit(0);
         }
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 0, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - (p.y - d) / 2;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = d >> 1, hi = d - 1;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[p.y] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[p.y] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 1, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         cnt++;
         assert(cnt <= 10);
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d, cnt = 1;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
            cnt++;
         }
      }
assert(cnt < 11);
      if(!lo) who[lo] = rt;

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 1, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - (p.y - d) / 2;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - p.y + d;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz], par[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u), par[u] = p;
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         for(int i=n; i; i--) if(who[i]) {
            int u = who[i];
            while(i > lo) i--, u = par[u];
            who[lo] = u;
            break;
         }
      }
      if(!who[lo]) {
         act.ara = dep[lo];
         who[lo] = act.query().x;
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 2, hi = dfs(rt), cnt = 0, oi = hi;
      if(d > 2) {
         while(lo < hi) {
            cnt++;
            if(cnt > 9) {
               cout << "! " << hi << " " << oi << endl;
               exit(0);
            }
            int md = lo + hi + 1 >> 1;
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }

         if(!who[lo]) {
            if(dep[lo].size() > 1) {
               act.ara = dep[lo];
               who[lo] = act.query().x;
            }
            else who[lo] = dep[lo][0];
         }

         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else if(d > 1) {
         if(!dep[d].empty()) {
            act.ara = dep[d];
            p = act.query();
            if(p.y == d) {
               who[lo] = rt;
               goto done;
            }
         }
         act.ara = dep[1];
         who[lo] = act.query().x;
         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else who[lo] = rt;

      done: int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - p.y + d;
            else lo = md;
         }
      }

      if(!lo) who[lo] = rt;

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d, cnt = 0;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
            cnt++;
         }
      }
assert(cnt < 11);
      if(!lo) who[lo] = rt;

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 0, hi = d >> 1;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[p.y] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt),
      while(1) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(hi == lo) break;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

void dfs(int u, int p = 0, int lvl = 0)
{
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) dfs(v, u, lvl + 1);
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      dfs(rt);

      int lo = 1, hi = d;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         if(dep[md].empty()) hi = md - 1;
         else {
            act.ara = dep[md];
            p = act.query();
            who[p.y] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 2, hi = dfs(rt);
      if(d > 1) {
         while(lo < hi) {
            int md = lo + hi + 1 >> 1;
            act.ara = dep[md];
            p = act.query();
            who[md] = p.x;
            if(p.y ^ d) hi = md - 1;
            else lo = md;
         }

         if(!who[lo]) {
            if(dep[lo].size() > 1) {
               act.ara = dep[lo];
               who[lo] = act.query().x;
            }
            else who[lo] = dep[lo][0];
         }

         for(int i=0; i<sz; i++) dep[i].clear();
         dfs(who[lo]);
      }
      else who[lo] = rt;

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         cin >> u >> v;
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
         cnt++;
         if(cnt == 11 && !who[lo] && dep[lo].size() > 1) {
            cout << "! " << hi << " " << md << endl;
            exit(0);
         }
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz], par[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u), par[u] = p;
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt);
      while(lo < hi) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         for(int i=d; i; i--) if(who[i]) {
            int u = who[i];
            while(i > lo) i--, u = par[u];
            who[lo] = u;
            break;
         }
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt), cnt = 1, oo = lo, oi = hi;
      while(lo < hi) {
         cnt++;
         if(cnt > 10) {
            cout << "? " << oo << " " << oi << endl;
            exit(0);
         }
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt), cnt = 1;
      while(lo < hi) {
         cnt++;
         if(cnt > 11) {
            cout << "? " << lo << " " << hi << endl;
            exit(0);
         }
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      if(!who[lo]) {
         if(dep[lo].size() > 1) {
            act.ara = dep[lo];
            who[lo] = act.query().x;
         }
         else who[lo] = dep[lo][0];
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1001;

/// screw these rounds

typedef pair <int, int> pii;
#define x first
#define y second

struct action {
   vector <int> ara;

   void add(int x) {
      ara.push_back(x);
   }

   pii query() {
      cout << "? " << ara.size() << endl;
      for(int x : ara) cout << x << " ";
      cout << endl;
      ara.clear();

      pii p;
      cin >> p.x >> p.y;
      if(p.x < 0) exit(0);
      return p;
   }
};

int who[sz];
vector <int> g[sz], dep[sz];

int dfs(int u, int p = 0, int lvl = 0)
{
   int res = lvl;
   dep[lvl].push_back(u);
   for(int v : g[u]) if(v ^ p) res = max(res, dfs(v, u, lvl + 1));
   return res;
}

int main()
{
   int t;
   cin >> t;
   while(t--) {
      int n;
      cin >> n;
      for(int i=1; i<n; i++) {
         int u, v;
         scanf("%d %d", &u, &v);
         g[u].push_back(v);
         g[v].push_back(u);
      }

      action act;
      for(int i=1; i<=n; i++) act.add(i);

      pii p = act.query();
      int d = p.y, rt = p.x;

      int lo = d + 1 >> 1, hi = dfs(rt);
      while(1) {
         int md = lo + hi + 1 >> 1;
         act.ara = dep[md];
         p = act.query();
         who[md] = p.x;
         if(hi == lo) break;
         if(p.y ^ d) hi = md - 1;
         else lo = md;
      }

      for(int i=0; i<sz; i++) dep[i].clear();
      dfs(who[lo]);

      int ans = dep[d][0];
      if(dep[d].size() > 1) {
         act.ara = dep[d];
         ans = act.query().x;
      }

      cout << "! " << who[lo] << " " << ans << endl;

      string s;
      cin >> s;
      if(s[0] == 'I') exit(0);
      for(int i=0; i<sz; i++) g[i].clear(), dep[i].clear(), who[i] = 0;
   }
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;
const int MAXN = 1e6+7;
const int INF = 1e9+7;
const int MOD=  1e9+7;
#define LL long long
#define pb push_back
#define st first
#define nd second
typedef pair<int ,int > pii;
typedef vector<int >  pi;
pi g[maxn];
pi res;
char s[maxn];
int tmp;
int n;
void dfs(int u,int l,int d,int fa)
{
	if(d==l)
	{
		res.pb(u);
		return ;
	}
	for(int to:g[u])
	{
		if(to==fa)
		continue;
		dfs(to,l,d+1,u);
	}
	return ;
}
int tmpx,tmpy;
void query()
{
	printf("? %d",res.size());
	for(int to : res)
	{
		printf(" %d",to);
	}
	puts("");
	fflush(stdout);
	if(res.size())
	scanf("%d %d",&tmp,&tmpy);
	else
	{
		tmpy = 10001;
	}
	return ;
}
int check(int x,int l)
{
	res.clear();
	int i,j;
	dfs(x,l,0,-1);
	query();
	return tmpy;
}
int main()
{
	int i,j,m,t,z;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		for(i=1;i<n;i++)
		{
			int u,v;
			scanf("%d%d",&u,&v);
			g[u].pb(v);
			g[v].pb(u);
		}
		printf("? %d",n);
		for(i=1;i<=n;i++)
		{
			printf(" %d",i);
		}
		puts("");
		fflush(stdout);
		int x,v;
		scanf("%d %d",&x,&v);
		int l =(v+1)/2,r=v;
		int ans ;
		while(l<=r)
		{
			int mid = (l+r)>>1;
			if(check(x,mid)<=v)
			{
				ans=tmp;
				l=mid+1;
			}
			else
			{
				r=mid-1;
			}
		}
		dfs(ans,v,0,-1);
		query();
		printf("! %d %d\n",ans,tmp);
		fflush(stdout);
		scanf("%s",s);
		for(i=1;i<=n;i++)
		g[i].clear();
	}
	return 0;
 }