#include <bits/stdc++.h>
using namespace std;

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define l(i,a,b) for(int i=a;i<b;i++)
#define L(i,a,b) for(int i=a;i<=b;i++)
#define r(i,a,b) for(int i=a;i>=b;i--)
#define R(i,a,b) for(int i=a;i>b;i--)
#define scanl(a) scanf("%lld",&a)
#define scani(a) scanf("%d",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanil(a,b) scanf("%d %lld",&a,&b)
#define pr(a) cout<<a<<" "<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" a "<<b<<" b "<<c<<"\n"
#define input(a,n) l(i,0,n) cin>>a[i];
const int N = int(5*1e5+3);

long long int mod = 1e8+7;

//long long int mod = 1000000000;
//ll mod=998244353;
long long  int power(long long int x,long long int y)
{
    if(y==0) return 1;
    if(y%2==0) return power(x*x%mod,y/2)%mod;
    else return x*power(x*x%mod,y/2)%mod;
}

long long int GCD(long long int a,long long  int b)
{
    if (a == 0)
        return b;
    return GCD(b % a, a);
}

/*
int n=10;
struct node1 {
    long long int sum,prefix,suffix;
    sum=prefix=suffix=0;
};
struct node1 tree[2*n+2];

void join(int node){
    int l=2*node,r=l+1;
    tree[node].sum = tree[l].sum+tree[r].sum;
    tree[node].prefix = max(tree[l].prefix,tree[l].sum+tree[r].prefix);
    tree[node].suffix = max(tree[r].suffix,tree[l].suffix+tree[r].sum);
}

void build(int node , int l ,int r){
    if(l==r){
        tree[node].sum = a[l];
        tree[node].prefix = max(0,a[l]);
        tree[node].suffix = max(0,a[l]);
    } else {
        int mid = (l+r)/2;
        auto first,second;
        build(2*node,l,mid);
        build(2*node+1,mid+1,r);
        join(node,2*node,2*node+1);
    }
}

void update(int node,int l,int r,int p){
    if(l>r){
        return ;
    } else if(l==p && r==p){
        tree[node].sum=a[p];
        tree[node].prefix=max(0,a[p]);
        tree[node].suffix = max(0,a[p]);
    } else {
        int mid = (l+r)/2;
        update(2*node,l,mid,p);
        update(2*node+1,mid+1,r,p);
        join(node);
    }
}

node1 query(int node,int l,int r, int start,int last){
    if(start<=l && last>=r){
        return tree[node];
    } else if(l>r){
        return null;
    }
    int mid = (l+r)/2;
    auto first,second;
    first= query(2*node,l,mid,start,last);
    second = query(2*node+1,mid+1,r,start,last);
    join
}
*/

/*
void bfs(int s,int f){
    visit[s]=true;
    dp[s]=f;
    if(f%2) od.push_back(s);
    else ev.push_back(s);
    for(auto i: vect[s]){
        if(!visit[i]){
            parent[i]=s;
            bfs(i,f+1);
        }else if(parent[s]!=i){
            l=s;
            r=i;
            return;
        }
        if(l!=-1)
                return;
    }
}

int maint(){
    int n,m,k;
    cin>>n>>m>>k;
    int a,b;
    l(i,0,m){
        cin>>a>>b;
        vect[a].push_back(b);
        vect[b].push_back(a);
    }
    bfs(1,1);
    //pr2(l,r);
    if(l==-1){
        cout<<1<<endl;
        if(od.size()>ev.size()){
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
        }else
            for(int i=0;i<k/2+k%2;i++){
                cout<<ev[i]<<" ";
            }
        cout<<endl;
    }else {
        od.clear(),ev.clear();
        vector<int> kit,sit;
        if(dp[l]<dp[r]){
            //pr2(dp[l],dp[r]);
            swap(l,r);
        }
        //pr2(dp[l],dp[r]);
        while(dp[l]!=dp[r]){
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
            //pr2(dp[l],dp[r]);
            kit.push_back(l);
            l=parent[l];
        }
        if(dp[l]==dp[r] ){
            while(l!=r){
                if(dp[l]%2) od.push_back(l);
                else ev.push_back(l);
                if(dp[r]%2) od.push_back(r);
                else ev.push_back(r);
                kit.push_back(l);
                sit.push_back(r);
                l=parent[l];
                r=parent[r];
            }
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
        }
        if(kit.size()+sit.size()<=k){
            cout<<2<<endl;
            cout<<kit.size()+sit.size()<<endl;
            for(auto it=sit.rbegin();it!=sit.rend();it++){
                cout<<*it<<" ";
            }
            for(auto it: kit){
                cout<<it<<" ";
            }
        } else {
            cout<<1<<endl;
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
            cout<<endl;
        }
    }

}
*/

int main(){
    FASTIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> vect[n+1];
        bool visit[n+1];
        int par[n+1],pos[n+1];
        int x,y;
        visit[n]=false;
        l(i,0,n-1) {
            visit[i+1]=false;
            cin>>x>>y;
            vect[x].push_back(y);
            vect[y].push_back(x);
        }
        cout<<"? "<<n<<" ";
        l(i,1,n+1){
            cout<<i<<" ";
        }
        cout<<endl;
        cin>>x>>y;
        cout.flush();
        pos[x]=0;
        string str;
        if(y==0){
            cout<<"! "<<x<<" "<<x<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        queue<int> qu;
        qu.push(x);
        vector<int> v[n+1];
        int s;
        v[0].push_back(x);
        while(qu.size()){
            s= qu.front();
            qu.pop();
            visit[s]=true;
            for(auto i: vect[s]){
                if(!visit[i]){
                    qu.push(i);
                    par[i]=s;
                    pos[i]=pos[s]+1;
                    v[pos[i]].push_back(i);
                }
            }
        }
        int small=-1,big=0;

        cout.flush();
        l(i,1,n+1){
            if(v[i].size()==0){
                break;
            }else if(v[i].size()>1){
                small=i;
            }
            if(v[i].size()){
                big=i;
            }
        }
        //pr2(big,small);
        int l,r;
        r=min(big,y);
        if(small==-1){
            cout<<"! "<<x<<" "<<v[y][0]<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        int d = y-small;
        l=max(y/2,small);
        int mid,place=0,a,b,val=x;
        while(l<=r){
            mid = (l+r)/2;
            cout<<"? "<<v[mid].size()<<" ";
            for(auto i: v[mid]){
                cout<<i<<" ";
            }
            cout<<endl;
            cout.flush();
            cin>>a>>b;

            if(b==y){
                place = mid;
                val=a;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        d = y-place;
        //pr2(place,x);
        if(d==0){
            cout<<"! "<<x<<" "<<val<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        s=val;
        while(s!=x){
            visit[s]=false;
            s = par[s];
        }
        cout<<"? "<<v[d].size()-1<<" ";
        for(auto i: v[d]){
            if(visit[i]==true){
                cout<<i<<" ";
            }

        }
        cout<<endl;
            cin>>a>>b;
            cout.flush();
        cout<<"! "<<a<<" "<<val<<endl;
        cin>>str;
        cout.flush();
    }
}

/*
1
10
1 2
1 5
2 3
2 4
3 9
4 8
4 10
5 6
6 7
*/


#include <bits/stdc++.h>
using namespace std;

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define l(i,a,b) for(int i=a;i<b;i++)
#define L(i,a,b) for(int i=a;i<=b;i++)
#define r(i,a,b) for(int i=a;i>=b;i--)
#define R(i,a,b) for(int i=a;i>b;i--)
#define scanl(a) scanf("%lld",&a)
#define scani(a) scanf("%d",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanil(a,b) scanf("%d %lld",&a,&b)
#define pr(a) cout<<a<<" "<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" a "<<b<<" b "<<c<<"\n"
#define input(a,n) l(i,0,n) cin>>a[i];
const int N = int(5*1e5+3);

long long int mod = 1e8+7;

//long long int mod = 1000000000;
//ll mod=998244353;
long long  int power(long long int x,long long int y)
{
    if(y==0) return 1;
    if(y%2==0) return power(x*x%mod,y/2)%mod;
    else return x*power(x*x%mod,y/2)%mod;
}

long long int GCD(long long int a,long long  int b)
{
    if (a == 0)
        return b;
    return GCD(b % a, a);
}

/*
int n=10;
struct node1 {
    long long int sum,prefix,suffix;
    sum=prefix=suffix=0;
};
struct node1 tree[2*n+2];

void join(int node){
    int l=2*node,r=l+1;
    tree[node].sum = tree[l].sum+tree[r].sum;
    tree[node].prefix = max(tree[l].prefix,tree[l].sum+tree[r].prefix);
    tree[node].suffix = max(tree[r].suffix,tree[l].suffix+tree[r].sum);
}

void build(int node , int l ,int r){
    if(l==r){
        tree[node].sum = a[l];
        tree[node].prefix = max(0,a[l]);
        tree[node].suffix = max(0,a[l]);
    } else {
        int mid = (l+r)/2;
        auto first,second;
        build(2*node,l,mid);
        build(2*node+1,mid+1,r);
        join(node,2*node,2*node+1);
    }
}

void update(int node,int l,int r,int p){
    if(l>r){
        return ;
    } else if(l==p && r==p){
        tree[node].sum=a[p];
        tree[node].prefix=max(0,a[p]);
        tree[node].suffix = max(0,a[p]);
    } else {
        int mid = (l+r)/2;
        update(2*node,l,mid,p);
        update(2*node+1,mid+1,r,p);
        join(node);
    }
}

node1 query(int node,int l,int r, int start,int last){
    if(start<=l && last>=r){
        return tree[node];
    } else if(l>r){
        return null;
    }
    int mid = (l+r)/2;
    auto first,second;
    first= query(2*node,l,mid,start,last);
    second = query(2*node+1,mid+1,r,start,last);
    join
}
*/

/*
void bfs(int s,int f){
    visit[s]=true;
    dp[s]=f;
    if(f%2) od.push_back(s);
    else ev.push_back(s);
    for(auto i: vect[s]){
        if(!visit[i]){
            parent[i]=s;
            bfs(i,f+1);
        }else if(parent[s]!=i){
            l=s;
            r=i;
            return;
        }
        if(l!=-1)
                return;
    }
}

int maint(){
    int n,m,k;
    cin>>n>>m>>k;
    int a,b;
    l(i,0,m){
        cin>>a>>b;
        vect[a].push_back(b);
        vect[b].push_back(a);
    }
    bfs(1,1);
    //pr2(l,r);
    if(l==-1){
        cout<<1<<endl;
        if(od.size()>ev.size()){
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
        }else
            for(int i=0;i<k/2+k%2;i++){
                cout<<ev[i]<<" ";
            }
        cout<<endl;
    }else {
        od.clear(),ev.clear();
        vector<int> kit,sit;
        if(dp[l]<dp[r]){
            //pr2(dp[l],dp[r]);
            swap(l,r);
        }
        //pr2(dp[l],dp[r]);
        while(dp[l]!=dp[r]){
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
            //pr2(dp[l],dp[r]);
            kit.push_back(l);
            l=parent[l];
        }
        if(dp[l]==dp[r] ){
            while(l!=r){
                if(dp[l]%2) od.push_back(l);
                else ev.push_back(l);
                if(dp[r]%2) od.push_back(r);
                else ev.push_back(r);
                kit.push_back(l);
                sit.push_back(r);
                l=parent[l];
                r=parent[r];
            }
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
        }
        if(kit.size()+sit.size()<=k){
            cout<<2<<endl;
            cout<<kit.size()+sit.size()<<endl;
            for(auto it=sit.rbegin();it!=sit.rend();it++){
                cout<<*it<<" ";
            }
            for(auto it: kit){
                cout<<it<<" ";
            }
        } else {
            cout<<1<<endl;
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
            cout<<endl;
        }
    }

}
*/

int main(){
    FASTIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> vect[n+1];
        bool visit[n+1];
        int par[n+1],pos[n+1];
        int x,y;
        visit[n]=false;
        l(i,0,n-1) {
            visit[i+1]=false;
            cin>>x>>y;
            vect[x].push_back(y);
            vect[y].push_back(x);
        }
        cout<<"? "<<n<<" ";
        l(i,1,n+1){
            cout<<i<<" ";
        }
        cout<<endl;
        cin>>x>>y;
        cout.flush();
        pos[x]=0;
        string str;
        if(y==0){
            cout<<"! "<<x<<" "<<x<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        queue<int> qu;
        qu.push(x);
        vector<int> v[n+1];
        int s;
        v[0].push_back(x);
        while(qu.size()){
            s= qu.front();
            qu.pop();
            visit[s]=true;
            for(auto i: vect[s]){
                if(!visit[i]){
                    qu.push(i);
                    par[i]=s;
                    pos[i]=pos[s]+1;
                    v[pos[i]].push_back(i);
                }
            }
        }
        int small=-1,big=0;

        cout.flush();
        l(i,1,n+1){
            if(v[i].size()==0){
                break;
            }else if(v[i].size()>1){
                small=i;
            }
            if(v[i].size()){
                big=i;
            }
        }
        //pr2(big,small);
        int l,r;
        r=min(big,y);
        if(small==-1){
            cout<<"! "<<x<<" "<<v[y][0]<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        int d = y-small;
        l=r/2;
        int mid,place=0,a,b,val=x;
        while(l<=r){
            mid = (l+r)/2;
            cout<<"? "<<v[mid].size()<<" ";
            for(auto i: v[mid]){
                cout<<i<<" ";
            }
            cout<<endl;
            cout.flush();
            cin>>a>>b;

            if(b==y){
                place = mid;
                val=a;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        d = y-place;
        //pr2(place,x);
        if(d==0){
            cout<<"! "<<x<<" "<<val<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        s=val;
        while(s!=x){
            visit[s]=false;
            s = par[s];
        }
        cout<<"? "<<v[d].size()-1<<" ";
        for(auto i: v[d]){
            if(visit[i]==true){
                cout<<i<<" ";
            }

        }
        cout<<endl;
            cin>>a>>b;
            cout.flush();
        cout<<"! "<<a<<" "<<val<<endl;
        cin>>str;
        cout.flush();
    }
}

/*
1
10
1 2
1 5
2 3
2 4
3 9
4 8
4 10
5 6
6 7
*/


#include <bits/stdc++.h>
using namespace std;

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define l(i,a,b) for(int i=a;i<b;i++)
#define L(i,a,b) for(int i=a;i<=b;i++)
#define r(i,a,b) for(int i=a;i>=b;i--)
#define R(i,a,b) for(int i=a;i>b;i--)
#define scanl(a) scanf("%lld",&a)
#define scani(a) scanf("%d",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanil(a,b) scanf("%d %lld",&a,&b)
#define pr(a) cout<<a<<" "<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" a "<<b<<" b "<<c<<"\n"
#define input(a,n) l(i,0,n) cin>>a[i];
const int N = int(5*1e5+3);

long long int mod = 1e8+7;

//long long int mod = 1000000000;
//ll mod=998244353;
long long  int power(long long int x,long long int y)
{
    if(y==0) return 1;
    if(y%2==0) return power(x*x%mod,y/2)%mod;
    else return x*power(x*x%mod,y/2)%mod;
}

long long int GCD(long long int a,long long  int b)
{
    if (a == 0)
        return b;
    return GCD(b % a, a);
}

/*
int n=10;
struct node1 {
    long long int sum,prefix,suffix;
    sum=prefix=suffix=0;
};
struct node1 tree[2*n+2];

void join(int node){
    int l=2*node,r=l+1;
    tree[node].sum = tree[l].sum+tree[r].sum;
    tree[node].prefix = max(tree[l].prefix,tree[l].sum+tree[r].prefix);
    tree[node].suffix = max(tree[r].suffix,tree[l].suffix+tree[r].sum);
}

void build(int node , int l ,int r){
    if(l==r){
        tree[node].sum = a[l];
        tree[node].prefix = max(0,a[l]);
        tree[node].suffix = max(0,a[l]);
    } else {
        int mid = (l+r)/2;
        auto first,second;
        build(2*node,l,mid);
        build(2*node+1,mid+1,r);
        join(node,2*node,2*node+1);
    }
}

void update(int node,int l,int r,int p){
    if(l>r){
        return ;
    } else if(l==p && r==p){
        tree[node].sum=a[p];
        tree[node].prefix=max(0,a[p]);
        tree[node].suffix = max(0,a[p]);
    } else {
        int mid = (l+r)/2;
        update(2*node,l,mid,p);
        update(2*node+1,mid+1,r,p);
        join(node);
    }
}

node1 query(int node,int l,int r, int start,int last){
    if(start<=l && last>=r){
        return tree[node];
    } else if(l>r){
        return null;
    }
    int mid = (l+r)/2;
    auto first,second;
    first= query(2*node,l,mid,start,last);
    second = query(2*node+1,mid+1,r,start,last);
    join
}
*/

/*
void bfs(int s,int f){
    visit[s]=true;
    dp[s]=f;
    if(f%2) od.push_back(s);
    else ev.push_back(s);
    for(auto i: vect[s]){
        if(!visit[i]){
            parent[i]=s;
            bfs(i,f+1);
        }else if(parent[s]!=i){
            l=s;
            r=i;
            return;
        }
        if(l!=-1)
                return;
    }
}

int maint(){
    int n,m,k;
    cin>>n>>m>>k;
    int a,b;
    l(i,0,m){
        cin>>a>>b;
        vect[a].push_back(b);
        vect[b].push_back(a);
    }
    bfs(1,1);
    //pr2(l,r);
    if(l==-1){
        cout<<1<<endl;
        if(od.size()>ev.size()){
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
        }else
            for(int i=0;i<k/2+k%2;i++){
                cout<<ev[i]<<" ";
            }
        cout<<endl;
    }else {
        od.clear(),ev.clear();
        vector<int> kit,sit;
        if(dp[l]<dp[r]){
            //pr2(dp[l],dp[r]);
            swap(l,r);
        }
        //pr2(dp[l],dp[r]);
        while(dp[l]!=dp[r]){
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
            //pr2(dp[l],dp[r]);
            kit.push_back(l);
            l=parent[l];
        }
        if(dp[l]==dp[r] ){
            while(l!=r){
                if(dp[l]%2) od.push_back(l);
                else ev.push_back(l);
                if(dp[r]%2) od.push_back(r);
                else ev.push_back(r);
                kit.push_back(l);
                sit.push_back(r);
                l=parent[l];
                r=parent[r];
            }
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
        }
        if(kit.size()+sit.size()<=k){
            cout<<2<<endl;
            cout<<kit.size()+sit.size()<<endl;
            for(auto it=sit.rbegin();it!=sit.rend();it++){
                cout<<*it<<" ";
            }
            for(auto it: kit){
                cout<<it<<" ";
            }
        } else {
            cout<<1<<endl;
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
            cout<<endl;
        }
    }

}
*/

int main(){
    FASTIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> vect[n+1];
        bool visit[n+1];
        int par[n+1],pos[n+1];
        int x,y;
        l(i,0,n-1) {
            visit[i+1]=false;
            cin>>x>>y;
            vect[x].push_back(y);
            vect[y].push_back(x);
        }
        cout<<"? "<<n<<" ";
        l(i,1,n+1){
            cout<<i<<" ";
        }
        cout<<endl;
        cin>>x>>y;
        cout.flush();
        pos[x]=0;
        string str;
        if(y==0){
            cout<<"! "<<x<<" "<<x<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        queue<int> qu;
        qu.push(x);
        vector<int> v[n+1];
        int s;
        v[0].push_back(x);
        while(qu.size()){
            s= qu.front();
            qu.pop();
            visit[s]=true;
            for(auto i: vect[s]){
                if(!visit[i]){
                    qu.push(i);
                    par[i]=s;
                    pos[i]=pos[s]+1;
                    v[pos[i]].push_back(i);
                }
            }
        }
        int small=-1,big=0;
        cout.flush();
        l(i,1,n+1){
            if(v[i].size()==0){
                break;
            }else if(v[i].size()>1){
                small=i;
            }
            if(v[i].size()){
                big=i;
            }
        }
        int l,r;
        r=min(big,y);
        if(small==-1){
            cout<<"! "<<x<<" "<<v[y][0]<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        int d = y-small;
        if(d<0){
            l=0;
        }else {
            l=d;
        }
        int mid,place=0,a,b,val=x;
        while(l<=r){
            mid = (l+r)/2;
            cout<<"? "<<v[mid].size()<<" ";
            for(auto i: v[mid]){
                cout<<i<<" ";
            }
            cout<<endl;
            cout.flush();
            cin>>a>>b;

            if(b==y){
                place = mid;
                val=a;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        d = y-place;
        //pr2(place,x);
        if(d==0){
            cout<<"! "<<x<<" "<<val<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        s=val;
        while(s!=x){
            visit[s]=false;
            s = par[s];
        }
        cout<<"? "<<v[d].size()-1<<" ";
        for(auto i: v[d]){
            if(visit[i]==true){
                cout<<i<<" ";
            }

        }
        cout<<endl;
            cin>>a>>b;
            cout.flush();
        cout<<"! "<<a<<" "<<val<<endl;
        cin>>str;
        cout.flush();
    }
}

/*
1
10
1 2
1 5
2 3
2 4
3 9
4 8
4 10
5 6
6 7
*/


#include <bits/stdc++.h>
using namespace std;

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define l(i,a,b) for(int i=a;i<b;i++)
#define L(i,a,b) for(int i=a;i<=b;i++)
#define r(i,a,b) for(int i=a;i>=b;i--)
#define R(i,a,b) for(int i=a;i>b;i--)
#define scanl(a) scanf("%lld",&a)
#define scani(a) scanf("%d",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanil(a,b) scanf("%d %lld",&a,&b)
#define pr(a) cout<<a<<" "<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" a "<<b<<" b "<<c<<"\n"
#define input(a,n) l(i,0,n) cin>>a[i];
const int N = int(5*1e5+3);

long long int mod = 1e8+7;

//long long int mod = 1000000000;
//ll mod=998244353;
long long  int power(long long int x,long long int y)
{
    if(y==0) return 1;
    if(y%2==0) return power(x*x%mod,y/2)%mod;
    else return x*power(x*x%mod,y/2)%mod;
}

long long int GCD(long long int a,long long  int b)
{
    if (a == 0)
        return b;
    return GCD(b % a, a);
}

/*
int n=10;
struct node1 {
    long long int sum,prefix,suffix;
    sum=prefix=suffix=0;
};
struct node1 tree[2*n+2];

void join(int node){
    int l=2*node,r=l+1;
    tree[node].sum = tree[l].sum+tree[r].sum;
    tree[node].prefix = max(tree[l].prefix,tree[l].sum+tree[r].prefix);
    tree[node].suffix = max(tree[r].suffix,tree[l].suffix+tree[r].sum);
}

void build(int node , int l ,int r){
    if(l==r){
        tree[node].sum = a[l];
        tree[node].prefix = max(0,a[l]);
        tree[node].suffix = max(0,a[l]);
    } else {
        int mid = (l+r)/2;
        auto first,second;
        build(2*node,l,mid);
        build(2*node+1,mid+1,r);
        join(node,2*node,2*node+1);
    }
}

void update(int node,int l,int r,int p){
    if(l>r){
        return ;
    } else if(l==p && r==p){
        tree[node].sum=a[p];
        tree[node].prefix=max(0,a[p]);
        tree[node].suffix = max(0,a[p]);
    } else {
        int mid = (l+r)/2;
        update(2*node,l,mid,p);
        update(2*node+1,mid+1,r,p);
        join(node);
    }
}

node1 query(int node,int l,int r, int start,int last){
    if(start<=l && last>=r){
        return tree[node];
    } else if(l>r){
        return null;
    }
    int mid = (l+r)/2;
    auto first,second;
    first= query(2*node,l,mid,start,last);
    second = query(2*node+1,mid+1,r,start,last);
    join
}
*/

/*
void bfs(int s,int f){
    visit[s]=true;
    dp[s]=f;
    if(f%2) od.push_back(s);
    else ev.push_back(s);
    for(auto i: vect[s]){
        if(!visit[i]){
            parent[i]=s;
            bfs(i,f+1);
        }else if(parent[s]!=i){
            l=s;
            r=i;
            return;
        }
        if(l!=-1)
                return;
    }
}

int maint(){
    int n,m,k;
    cin>>n>>m>>k;
    int a,b;
    l(i,0,m){
        cin>>a>>b;
        vect[a].push_back(b);
        vect[b].push_back(a);
    }
    bfs(1,1);
    //pr2(l,r);
    if(l==-1){
        cout<<1<<endl;
        if(od.size()>ev.size()){
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
        }else
            for(int i=0;i<k/2+k%2;i++){
                cout<<ev[i]<<" ";
            }
        cout<<endl;
    }else {
        od.clear(),ev.clear();
        vector<int> kit,sit;
        if(dp[l]<dp[r]){
            //pr2(dp[l],dp[r]);
            swap(l,r);
        }
        //pr2(dp[l],dp[r]);
        while(dp[l]!=dp[r]){
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
            //pr2(dp[l],dp[r]);
            kit.push_back(l);
            l=parent[l];
        }
        if(dp[l]==dp[r] ){
            while(l!=r){
                if(dp[l]%2) od.push_back(l);
                else ev.push_back(l);
                if(dp[r]%2) od.push_back(r);
                else ev.push_back(r);
                kit.push_back(l);
                sit.push_back(r);
                l=parent[l];
                r=parent[r];
            }
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
        }
        if(kit.size()+sit.size()<=k){
            cout<<2<<endl;
            cout<<kit.size()+sit.size()<<endl;
            for(auto it=sit.rbegin();it!=sit.rend();it++){
                cout<<*it<<" ";
            }
            for(auto it: kit){
                cout<<it<<" ";
            }
        } else {
            cout<<1<<endl;
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
            cout<<endl;
        }
    }

}
*/

int main(){
    FASTIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> vect[n+1];
        bool visit[n+1];
        int par[n+1],pos[n+1];
        int x,y;
        visit[n]=false;
        l(i,0,n-1) {
            visit[i+1]=false;
            cin>>x>>y;
            vect[x].push_back(y);
            vect[y].push_back(x);
        }
        cout<<"? "<<n<<" ";
        l(i,1,n+1){
            cout<<i<<" ";
        }
        cout<<endl;
        cin>>x>>y;
        cout.flush();
        pos[x]=0;
        string str;
        if(y==0){
            cout<<"! "<<x<<" "<<x<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        queue<int> qu;
        qu.push(x);
        vector<int> v[n+1];
        int s;
        v[0].push_back(x);
        while(qu.size()){
            s= qu.front();
            qu.pop();
            visit[s]=true;
            for(auto i: vect[s]){
                if(!visit[i]){
                    qu.push(i);
                    par[i]=s;
                    pos[i]=pos[s]+1;
                    v[pos[i]].push_back(i);
                }
            }
        }
        int small=-1,big=0;

        cout.flush();
        l(i,1,n+1){
            if(v[i].size()==0){
                break;
            }else if(v[i].size()>1){
                small=i;
            }
            if(v[i].size()){
                big=i;
            }
        }
        //pr2(big,small);
        int l,r;
        r=min(big,y);
        if(small==-1){
            cout<<"! "<<x<<" "<<v[y][0]<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        int d = y-small;
        if(d<0){
            l=0;
        }else {
            l=d;
        }
        int mid,place=0,a,b,val=x;
        while(l<=r){
            mid = (l+r)/2;
            cout<<"? "<<v[mid].size()<<" ";
            for(auto i: v[mid]){
                cout<<i<<" ";
            }
            cout<<endl;
            cout.flush();
            cin>>a>>b;

            if(b==y){
                place = mid;
                val=a;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        d = y-place;
        //pr2(place,x);
        if(d==0){
            cout<<"! "<<x<<" "<<val<<endl;
            cin>>str;
            cout.flush();
            continue;
        }
        s=val;
        while(s!=x){
            visit[s]=false;
            s = par[s];
        }
        cout<<"? "<<v[d].size()-1<<" ";
        for(auto i: v[d]){
            if(visit[i]==true){
                cout<<i<<" ";
            }

        }
        cout<<endl;
            cin>>a>>b;
            cout.flush();
        cout<<"! "<<a<<" "<<val<<endl;
        cin>>str;
        cout.flush();
    }
}

/*
1
10
1 2
1 5
2 3
2 4
3 9
4 8
4 10
5 6
6 7
*/


#include <bits/stdc++.h>
using namespace std;

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define l(i,a,b) for(int i=a;i<b;i++)
#define L(i,a,b) for(int i=a;i<=b;i++)
#define r(i,a,b) for(int i=a;i>=b;i--)
#define R(i,a,b) for(int i=a;i>b;i--)
#define scanl(a) scanf("%lld",&a)
#define scani(a) scanf("%d",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanil(a,b) scanf("%d %lld",&a,&b)
#define pr(a) cout<<a<<" "<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" a "<<b<<" b "<<c<<"\n"
#define input(a,n) l(i,0,n) cin>>a[i];
const int N = int(5*1e5+3);

long long int mod = 1e8+7;

//long long int mod = 1000000000;
//ll mod=998244353;
long long  int power(long long int x,long long int y)
{
    if(y==0) return 1;
    if(y%2==0) return power(x*x%mod,y/2)%mod;
    else return x*power(x*x%mod,y/2)%mod;
}

long long int GCD(long long int a,long long  int b)
{
    if (a == 0)
        return b;
    return GCD(b % a, a);
}

/*
int n=10;
struct node1 {
    long long int sum,prefix,suffix;
    sum=prefix=suffix=0;
};
struct node1 tree[2*n+2];

void join(int node){
    int l=2*node,r=l+1;
    tree[node].sum = tree[l].sum+tree[r].sum;
    tree[node].prefix = max(tree[l].prefix,tree[l].sum+tree[r].prefix);
    tree[node].suffix = max(tree[r].suffix,tree[l].suffix+tree[r].sum);
}

void build(int node , int l ,int r){
    if(l==r){
        tree[node].sum = a[l];
        tree[node].prefix = max(0,a[l]);
        tree[node].suffix = max(0,a[l]);
    } else {
        int mid = (l+r)/2;
        auto first,second;
        build(2*node,l,mid);
        build(2*node+1,mid+1,r);
        join(node,2*node,2*node+1);
    }
}

void update(int node,int l,int r,int p){
    if(l>r){
        return ;
    } else if(l==p && r==p){
        tree[node].sum=a[p];
        tree[node].prefix=max(0,a[p]);
        tree[node].suffix = max(0,a[p]);
    } else {
        int mid = (l+r)/2;
        update(2*node,l,mid,p);
        update(2*node+1,mid+1,r,p);
        join(node);
    }
}

node1 query(int node,int l,int r, int start,int last){
    if(start<=l && last>=r){
        return tree[node];
    } else if(l>r){
        return null;
    }
    int mid = (l+r)/2;
    auto first,second;
    first= query(2*node,l,mid,start,last);
    second = query(2*node+1,mid+1,r,start,last);
    join
}
*/

/*
void bfs(int s,int f){
    visit[s]=true;
    dp[s]=f;
    if(f%2) od.push_back(s);
    else ev.push_back(s);
    for(auto i: vect[s]){
        if(!visit[i]){
            parent[i]=s;
            bfs(i,f+1);
        }else if(parent[s]!=i){
            l=s;
            r=i;
            return;
        }
        if(l!=-1)
                return;
    }
}

int maint(){
    int n,m,k;
    cin>>n>>m>>k;
    int a,b;
    l(i,0,m){
        cin>>a>>b;
        vect[a].push_back(b);
        vect[b].push_back(a);
    }
    bfs(1,1);
    //pr2(l,r);
    if(l==-1){
        cout<<1<<endl;
        if(od.size()>ev.size()){
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
        }else
            for(int i=0;i<k/2+k%2;i++){
                cout<<ev[i]<<" ";
            }
        cout<<endl;
    }else {
        od.clear(),ev.clear();
        vector<int> kit,sit;
        if(dp[l]<dp[r]){
            //pr2(dp[l],dp[r]);
            swap(l,r);
        }
        //pr2(dp[l],dp[r]);
        while(dp[l]!=dp[r]){
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
            //pr2(dp[l],dp[r]);
            kit.push_back(l);
            l=parent[l];
        }
        if(dp[l]==dp[r] ){
            while(l!=r){
                if(dp[l]%2) od.push_back(l);
                else ev.push_back(l);
                if(dp[r]%2) od.push_back(r);
                else ev.push_back(r);
                kit.push_back(l);
                sit.push_back(r);
                l=parent[l];
                r=parent[r];
            }
            if(dp[l]%2) od.push_back(l);
            else ev.push_back(l);
        }
        if(kit.size()+sit.size()<=k){
            cout<<2<<endl;
            cout<<kit.size()+sit.size()<<endl;
            for(auto it=sit.rbegin();it!=sit.rend();it++){
                cout<<*it<<" ";
            }
            for(auto it: kit){
                cout<<it<<" ";
            }
        } else {
            cout<<1<<endl;
            for(int i=0;i<k/2+k%2;i++){
                cout<<od[i]<<" ";
            }
            cout<<endl;
        }
    }

}
*/

int main(){
    FASTIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> vect[n+1];
        bool visit[n+1];
        int par[n+1],pos[n+1];
        int x,y;
        l(i,0,n-1) {
            visit[i+1]=false;
            cin>>x>>y;
            vect[x].push_back(y);
            vect[y].push_back(x);
        }
        cout<<"? "<<n<<" ";
        l(i,1,n+1){
            cout<<i<<" ";
        }
        cout<<endl;
        cin>>x>>y;
        cout<<endl;
        pos[x]=0;
        string str;
        if(y==0){
            cout<<"! "<<x<<" "<<x<<endl;
            cin>>str;
            cout<<endl;
            continue;
        }
        queue<int> qu;
        qu.push(x);
        vector<int> v[n+1];
        int s;
        v[0].push_back(x);
        while(qu.size()){
            s= qu.front();
            qu.pop();
            visit[s]=true;
            for(auto i: vect[s]){
                if(!visit[i]){
                    qu.push(i);
                    par[i]=s;
                    pos[i]=pos[s]+1;
                    v[pos[i]].push_back(i);
                }
            }
        }
        int small=-1,big=0;
        cout<<endl;
        l(i,1,n+1){
            if(v[i].size()==0){
                break;
            }else if(v[i].size()>1){
                small=i;
            }
            if(v[i].size()){
                big=i;
            }
        }
        int l,r;
        r=min(big,y);
        if(small==-1){
            cout<<"! "<<x<<" "<<v[y][0]<<endl;
            cin>>str;
            cout<<endl;
            continue;
        }
        int d = y-small;
        if(d<0){
            l=1;
        }else {
            l=d;
        }
        int mid,place=0,a,b,val=x;
        while(l<=r){
            mid = (l+r)/2;
            cout<<"? "<<v[mid].size()<<" ";
            for(auto i: v[mid]){
                cout<<i<<" ";
            }
            cout<<endl;
            cin>>a>>b;
            cout<<endl;
            if(b==y){
                place = mid;
                val=a;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        d = y-place;
        if(d==0){
            cout<<"! "<<x<<" "<<place<<endl;
            cin>>str;
            cout<<endl;
            continue;
        }
        s=val;
        while(s!=x){
            visit[s]=false;
            s = par[s];
        }
        cout<<"? "<<v[d].size()-1<<" ";
        for(auto i: v[d]){
            if(visit[i]==true){
                cout<<i<<" ";
            }

        }
        cout<<endl;
            cin>>a>>b;
            cout<<endl;
        cout<<"! "<<a<<" "<<val<<endl;
        cin>>str;
        cout<<endl;
    }
}

/*
1
10
1 2
1 5
2 3
2 4
3 9
4 8
4 10
5 6
6 7
*/


#include<iostream>
#include<cstdio>
#include<string>
#include<ctime>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<stack>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<cassert>
using namespace std;

typedef long long LL;

typedef unsigned long long ull;

const int inf=0x3f3f3f3f;

const int N=1e3+100;

int n,max_deep;

vector<int>node[N],deep[N];

pair<int,int> query(int dep)
{
	printf("? %d",deep[dep].size());
	for(auto v:deep[dep])
		printf(" %d",v);
	puts("");
	fflush(stdout);
	int rt,len;
	scanf("%d%d",&rt,&len);
	return make_pair(rt,len);
}

void dfs(int u,int fa,int dep)
{
	max_deep=max(max_deep,dep);
	deep[dep].push_back(u);
	for(auto v:node[u])
	{
		if(v==fa)
			continue;
		dfs(v,u,dep+1);
	}
}

void build(int rt)
{
	max_deep=0;
	for(int i=0;i<=n;i++)
		deep[i].clear();
	dfs(rt,-1,0);
}

pair<int,int> get_root()
{
	printf("? %d",n);
	for(int i=1;i<=n;i++)
		printf(" %d",i);
	puts("");
	fflush(stdout);
	int rt,len;
	scanf("%d%d",&rt,&len);
	return make_pair(rt,len);
}

int main()
{
#ifndef ONLINE_JUDGE
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
#endif
//  ios::sync_with_stdio(false);
	int w;
	cin>>w;
	while(w--)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
			node[i].clear();
		for(int i=1;i<n;i++)
		{
			int u,v;
			scanf("%d%d",&u,&v);
			node[u].push_back(v);
			node[v].push_back(u);
		}
		pair<int,int>temp=get_root();
		int rt=temp.first,len=temp.second;
		build(rt);
		int l=(len+1)/2,r=min(max_deep,len),s;
		while(l<=r)
		{
			int mid=l+r>>1;
			temp=query(mid);
			int p=temp.first,d=temp.second;
			if(d==len)
			{
				s=p;
				l=mid+1;
			}
			else
				r=mid-1;
		}
		build(s);
		int t=query(len).first;
		printf("! %d %d\n",s,t);
		fflush(stdout);
		scanf("%*s");
	}
    return 0;
}


#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <random>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

pii ask(vi a) {
	if (a.empty()) return { -1, -1 };
	cout << "? " << sz(a) << endl;
	for (int x : a) {
		cout << x + 1 << ' ';
	}
	cout << endl;
	int v, d;
	cin >> v >> d;
	return make_pair(v - 1, d);
}

int n;
vector<vi> g;
vector<vi> ol;
int mp=0;
void get_lvl(int v, int p, int dep) {
    mp=max(mp,dep);
	ol[dep].pb(v);
	for (int to : g[v]) {
		if (to != p) {
			get_lvl(to, v, dep + 1);
		}
	}
}

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t--) {
		g.clear();
		cin >> n;
		g.resize(n);
		for (int i = 0; i < n - 1; i++) {
			int u, v; cin >> u >> v; --u; --v; g[u].pb(v); g[v].pb(u);
		}
		vi _all(n); iota(all(_all), 0); pii base = ask(_all);
		ol.clear(); ol.resize(n); get_lvl(base.first, -1, 0);
		int lf = (base.second+1)/2, rg = min(base.second,mp);
		while (ol[rg].empty()) {
			rg--;
		}
		pii lst = { -1, -1 };
		while (lf < rg) {
			int md = (lf + rg + 1) >> 1;
			auto kek = ask(ol[md]);
			if (kek.second == base.second) {
				lf = md;
				lst = kek;
			}
			else {
				rg = md - 1;
			}
		}
		int u = (lst != make_pair(-1, -1) ? lst.first : base.first);
		ol.clear(); ol.resize(n); get_lvl(u, -1, 0);
		int v = ask(ol[base.second]).first;
		cout << "! " << u + 1 << ' ' << v + 1 << endl;
		string s; cin >> s;
	}
}


#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <random>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

pii ask(vi a) {
	if (a.empty()) return { -1, -1 };
	cout << "? " << sz(a) << endl;
	for (int x : a) {
		cout << x + 1 << ' ';
	}
	cout << endl;
	int v, d;
	cin >> v >> d;
	return make_pair(v - 1, d);
}

int n;
vector<vi> g;
vector<vi> ol;
int mdep=0;
void get_lvl(int v, int p, int dep) {
    mdep=max(mdep,dep);
	ol[dep].pb(v);
	for (int to : g[v]) {
		if (to != p) {
			get_lvl(to, v, dep + 1);
		}
	}
}

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t--) {
		g.clear();
		cin >> n;
		g.resize(n);
		for (int i = 0; i < n - 1; i++) {
			int u, v; cin >> u >> v; --u; --v; g[u].pb(v); g[v].pb(u);
		}
		vi _all(n); iota(all(_all), 0); pii base = ask(_all);
		ol.clear(); ol.resize(n); get_lvl(base.first, -1, 0);
		int lf = (base.second+1)/2, rg = min(base.second,mdep+1);
		while (ol[rg].empty()) {
			rg--;
		}
		pii lst = { -1, -1 };
		while (lf < rg) {
			int md = (lf + rg + 1) >> 1;
			auto kek = ask(ol[md]);
			if (kek.second == base.second) {
				lf = md;
				lst = kek;
			}
			else {
				rg = md - 1;
			}
		}
		int u = (lst != make_pair(-1, -1) ? lst.first : base.first);
		ol.clear(); ol.resize(n); get_lvl(u, -1, 0);
		int v = ask(ol[base.second]).first;
		cout << "! " << u + 1 << ' ' << v + 1 << endl;
		string s; cin >> s;
	}
}


#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <random>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

pii ask(vi a) {
	if (a.empty()) return { -1, -1 };
	cout << "? " << sz(a) << endl;
	for (int x : a) {
		cout << x + 1 << ' ';
	}
	cout << endl;
	int v, d;
	cin >> v >> d;
	return make_pair(v - 1, d);
}

int n;
vector<vi> g;
vector<vi> ol;
int mdep=0;
void get_lvl(int v, int p, int dep) {
    mdep=max(mdep,dep);
	ol[dep].pb(v);
	for (int to : g[v]) {
		if (to != p) {
			get_lvl(to, v, dep + 1);
		}
	}
}

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t--) {
		g.clear();
		cin >> n;
		g.resize(n);
		for (int i = 0; i < n - 1; i++) {
			int u, v; cin >> u >> v; --u; --v; g[u].pb(v); g[v].pb(u);
		}
		vi _all(n); iota(all(_all), 0); pii base = ask(_all);
		ol.clear(); ol.resize(n); get_lvl(base.first, -1, 0);
		int lf = (base.second+1)/2, rg = min(base.second,mdep);
		while (ol[rg].empty()) {
			rg--;
		}
		pii lst = { -1, -1 };
		while (lf < rg) {
			int md = (lf + rg + 1) >> 1;
			auto kek = ask(ol[md]);
			if (kek.second == base.second) {
				lf = md;
				lst = kek;
			}
			else {
				rg = md - 1;
			}
		}
		int u = (lst != make_pair(-1, -1) ? lst.first : base.first);
		ol.clear(); ol.resize(n); get_lvl(u, -1, 0);
		int v = ask(ol[base.second]).first;
		cout << "! " << u + 1 << ' ' << v + 1 << endl;
		string s; cin >> s;
	}
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(d+1, max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = mini_dis/2 + 1, r = mini_dis + 1, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(depth[i], max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = 1, r = min(max_depth/2 + 1, max_depth), ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(depth[i], max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = 1, r = max_depth/2 + 1, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(d+1, max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = mini_dis/2 + mini_dis%2, r = max_depth, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(depth[i], max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = 1, r = max_depth/2 + max_depth%2, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(d+1, max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = (mini_dis+1)/2 + 1, r = mini_dis + 1, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(d+1, max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = (mini_dis+1)/2 + 1, r = min(mini_dis + 1, max_depth), ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(d+1, max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = max_depth/2, r = max_depth, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(d+1, max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = 1, r = mini_dis/2 + 1, ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(depth[i], max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = 1, r = min(max_depth/2 + max_depth%2, max_depth), ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(depth[i], max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 1;
        point[1].push_back(root);
        dfs(root, root, 1);
        int l = 0, r = min(max_depth/2 + 1, max_depth), ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1007;
vector<int> adj[maxn], depth(maxn), point[maxn], another;
int max_depth, mini_dis;
char s[20];
pii qry(vector<int> v){
    printf("? %d ", v.size());
    for(int i : v){
        printf("%d ", i);
    }
    printf("\n");
    fflush(stdout);
    pii now;
    scanf("%d%d", &now.first, &now.second);
    assert(now.first != -1);
    return now;
}
void dfs(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        depth[i] = d+1;
        max_depth = max(depth[i], max_depth);
        point[d+1].push_back(i);
        dfs(i, root, d+1);
    }
}
void dfs2(int root, int fa, int d){
    for(int i : adj[root]){
        if(i == fa){
            continue;
        }
        if(d == mini_dis){
            another.push_back(i);
        }
        else{
            dfs2(i, root, d+1);
        }
    }
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--){
        int n;
        scanf("%d", &n);
        max_depth = -1;
        for(int i = 0; i < maxn; ++i){
            adj[i].clear();
            point[i].clear();
            depth[i] = 0;
        }
        another.clear();
        for(int i = 1; i < n; ++i){
            int u, v;
            scanf("%d%d", &u, &v);
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        vector<int> all;
        for(int i = 1; i <= n; ++i){
            all.push_back(i);
        }
        pii tmp = qry(all);
        int root = tmp.first;
        mini_dis = tmp.second;
        depth[root] = 0;
        point[0].push_back(root);
        dfs(root, root, 1);
        int l = 0, r = min(max_depth/2 + 1, max_depth), ans = -1;
        while(l <= r){
            int mid = (l+r)/2;
            tmp = qry(point[mid]);
            if(mini_dis == tmp.second){
                l = mid + 1;
                ans = tmp.first;
            }
            else{
                r = mid - 1;
            }
        }
        dfs2(ans, ans, 1);
        tmp = qry(another);
        printf("! %d %d\n", ans, tmp.first);
        fflush(stdout);
        scanf("%s", s);
        if(s[0] == 'I'){
            return 0;
        }
    }
}


#include<cstdio>
#include<vector>
using namespace std;
int T,n,x,d,xx,dd;
vector<int> q,vec[1100],que[1100];
void Query(vector<int> &vec){
	putchar('?'); printf(" %d",(int)vec.size());
	for (int v:vec) printf(" %d",v);
	putchar('\n'); fflush(stdout);
}
void dfs(int u,int d,int fa){
	que[d].emplace_back(u);
	for (int v:vec[u]){
		if (v==fa) continue;
		dfs(v,d+1,u);
	}
}
bool check(int mid){
	Query(que[mid]); scanf("%d%d",&xx,&dd);
	return dd==d;
}
int main(){
	scanf("%d",&T);
	while (T--){
		scanf("%d",&n); int u,v;
		for (int i=1;i<n;i++){
			scanf("%d%d",&u,&v);
			vec[u].push_back(v);
			vec[v].push_back(u);
		}
		for (int i=0;i<n;i++) que[i].clear();
		q.clear();
		for (int i=1;i<=n;i++) q.emplace_back(i);
		Query(q); scanf("%d%d",&x,&d);
		dfs(x,0,0); q.clear();
		int l=(d-1)/2+1,r=d,mid,ans;
		while (l<=r){
			mid=(l+r)>>1;
			if (check(mid)){
				ans=xx;
				l=mid+1;
			} else r=mid-1;
		}
		for (int i=0;i<n;i++) que[i].clear();
		dfs(ans,0,0);
		Query(que[d]); scanf("%d%d",&x,&d);
		printf("! %d %d\n",ans,x); fflush(stdout);
		scanf("%*s");
	}
	return 0;
}


#include<cstdio>
#include<vector>
using namespace std;
int T,n,x,d,xx,dd;
vector<int> q,vec[1100],que[1100];
void Query(vector<int> &vec){
	putchar('?'); printf(" %d",(int)vec.size());
	for (int v:vec) printf(" %d",v);
	putchar('\n'); fflush(stdout);
}
void dfs(int u,int d,int fa){
	que[d].emplace_back(u);
	for (int v:vec[u]){
		if (v==fa) continue;
		dfs(v,d+1,u);
	}
}
bool check(int mid){
	Query(que[mid]); scanf("%d%d",&xx,&dd);
	return dd==d;
}
int main(){
	scanf("%d",&T);
	while (T--){
		scanf("%d",&n); int u,v;
		for (int i=1;i<n;i++){
			scanf("%d%d",&u,&v);
			vec[u].push_back(v);
			vec[v].push_back(u);
		}
		for (int i=0;i<n;i++) que[i].clear();
		q.clear();
		for (int i=1;i<=n;i++) q.emplace_back(i);
		Query(q); scanf("%d%d",&x,&d);
		dfs(x,0,0); q.clear();
		int l=(d-1)/2+1,r=d,mid,ans;
		while (l<=r){
			mid=(l+r)>>1;
			if (check(mid)){
				ans=xx;
				l=mid+1;
			} else r=mid-1;
		}
		for (int i=0;i<n;i++) que[i].clear();
		dfs(ans,0,0);
		Query(que[d]); scanf("%d%d",&x,&d);
		printf("! %d %d\n",ans,x);
	}
	return 0;
}


#include<cstdio>
#include<vector>
using namespace std;
int T,n,x,d,mx,xx,dd;
vector<int> q,vec[1100],que[1100];
void Query(vector<int> &vec){
	putchar('?'); printf(" %d",(int)vec.size());
	for (int v:vec) printf(" %d",v);
	putchar('\n'); fflush(stdout);
}
void dfs(int u,int d,int fa){
	que[d].emplace_back(u); mx=max(mx,d);
	for (int v:vec[u]){
		if (v==fa) continue;
		dfs(v,d+1,u);
	}
}
bool check(int mid){
	Query(que[mid]); scanf("%d%d",&xx,&dd);
	return dd==d;
}
int main(){
	scanf("%d",&T);
	while (T--){
		scanf("%d",&n); mx=0; int u,v;
		for (int i=1;i<=n;i++) vec[i].clear();
		for (int i=1;i<n;i++){
			scanf("%d%d",&u,&v);
			vec[u].push_back(v);
			vec[v].push_back(u);
		}
		for (int i=0;i<n;i++) que[i].clear();
		q.clear();
		for (int i=1;i<=n;i++) q.emplace_back(i);
		Query(q); scanf("%d%d",&x,&d);
		dfs(x,0,0); q.clear();
		int l=(d-1)/2+1,r=min(mx,d),mid,ans;
		while (l<=r){
			mid=(l+r)>>1;
			if (check(mid)){
				ans=xx;
				l=mid+1;
			} else r=mid-1;
		}
		for (int i=0;i<n;i++) que[i].clear();
		dfs(ans,0,0);
		Query(que[d]); scanf("%d%d",&x,&d);
		printf("! %d %d\n",ans,x); fflush(stdout);
		scanf("%*s");
	}
	return 0;
}


#include<cstdio>
#include<vector>
using namespace std;
int T,n,x,d,xx,dd;
vector<int> q,vec[1100],que[1100];
void Query(vector<int> &vec){
	putchar('?'); printf(" %d",(int)vec.size());
	for (int v:vec) printf(" %d",v);
	putchar('\n'); fflush(stdout);
}
void dfs(int u,int d,int fa){
	que[d].emplace_back(u);
	for (int v:vec[u]){
		if (v==fa) continue;
		dfs(v,d+1,u);
	}
}
bool check(int mid){
	Query(que[mid]); scanf("%d%d",&xx,&dd);
	return dd==d;
}
int main(){
	scanf("%d",&T);
	while (T--){
		scanf("%d",&n); int u,v;
		for (int i=1;i<=n;i++) vec[i].clear();
		for (int i=1;i<n;i++){
			scanf("%d%d",&u,&v);
			vec[u].push_back(v);
			vec[v].push_back(u);
		}
		for (int i=0;i<n;i++) que[i].clear();
		q.clear();
		for (int i=1;i<=n;i++) q.emplace_back(i);
		Query(q); scanf("%d%d",&x,&d);
		dfs(x,0,0); q.clear();
		int l=(d-1)/2+1,r=d,mid,ans;
		while (l<=r){
			mid=(l+r)>>1;
			if (check(mid)){
				ans=xx;
				l=mid+1;
			} else r=mid-1;
		}
		for (int i=0;i<n;i++) que[i].clear();
		dfs(ans,0,0);
		Query(que[d]); scanf("%d%d",&x,&d);
		printf("! %d %d\n",ans,x); fflush(stdout);
		scanf("%*s");
	}
	return 0;
}


#include<cstdio>
#include<vector>
using namespace std;
int T,n,x,d;
vector<int> q,vec[1100],que[1100];
void Query(vector<int> &vec){
	putchar('?'); printf(" %d",(int)vec.size());
	for (int v:vec) printf(" %d",v);
	putchar('\n'); fflush(stdout);
}
void dfs(int u,int d,int fa){
	que[d].emplace_back(u);
	for (int v:vec[u]){
		if (v==fa) continue;
		dfs(v,d+1,u);
	}
}
bool check(int mid){
	int xx,dd;
	Query(que[mid]); scanf("%d%d",&xx,&dd);
	return dd==d;
}
int main(){
	scanf("%d",&T);
	while (T--){
		scanf("%d",&n); int u,v;
		for (int i=1;i<n;i++){
			scanf("%d%d",&u,&v);
			vec[u].push_back(v);
			vec[v].push_back(u);
		}
		for (int i=0;i<n;i++) que[i].clear();
		q.clear();
		for (int i=1;i<=n;i++) q.emplace_back(i);
		Query(q); scanf("%d%d",&x,&d);
		dfs(x,0,0); q.clear();
		int l=(d-1)/2+1,r=d,mid;
		while (l<r){
			mid=(l+r+1)>>1;
			if (check(mid)) l=mid;
			else r=mid-1;
		}
		for (int i=0;i<n;i++) que[i].clear();
		dfs(l,0,0);
		Query(que[d]); scanf("%d%d",&x,&d);
		printf("! %d %d\n",x,l);
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<string>
using namespace std;
vector<int>e[1010];
vector<int>vec;
int getdep(int u,int lst)
{
	int res=0;
	for(int i=0;i<e[u].size();i++)
		if(e[u][i]!=lst)
			res=max(res,getdep(e[u][i],u)+1);
	return res;
}
void dfs(int u,int lst,int dep,int need)
{
	if(dep==need)
		vec.push_back(u);
	for(int i=0;i<e[u].size();i++)
		if(e[u][i]!=lst)
			dfs(e[u][i],u,dep+1,need);
	return ;
}
pair<int,int>query(int u,int d)
{
	vec.clear();dfs(u,0,0,d);
	printf("? %d",vec.size());
	for(int i=0;i<vec.size();i++)
		printf(" %d",vec[i]);
	printf("\n");fflush(stdout);
	int x,l;scanf("%d %d",&x,&l);
	return make_pair(x,l);
}
void solve()
{
	int n;scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	printf("? %d",n);
	for(int i=1;i<=n;i++)
		printf(" %d",i);
	printf("\n");fflush(stdout);
	int x,len;scanf("%d %d",&x,&len);
	int l=(len+1)/2-1,r=min(len,getdep(x,0))+1;
	int u=0;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		pair<int,int>pr=query(x,mid);
		if(pr.second==len)u=pr.first,l=mid;
		else r=mid;
	}
	printf("! %d %d\n",u,query(u,len).first);
	fflush(stdout);
	string blabla;
	cin>>blabla;
	return ;
}
int main()
{
	int t;scanf("%d",&t);
	while(t--)
		solve();
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<string>
using namespace std;
vector<int>e[1010];
vector<int>vec;
int getdep(int u,int lst)
{
	int res=0;
	for(int i=0;i<e[u].size();i++)
		if(e[u][i]!=lst)
			res=max(res,getdep(e[u][i],u)+1);
	return res;
}
void dfs(int u,int lst,int dep,int need)
{
	if(dep==need)
		vec.push_back(u);
	for(int i=0;i<e[u].size();i++)
		if(e[u][i]!=lst)
			dfs(e[u][i],u,dep+1,need);
	return ;
}
pair<int,int>query(int u,int d)
{
	vec.clear();dfs(u,0,0,d);
	printf("? %d",vec.size());
	for(int i=0;i<vec.size();i++)
		printf(" %d",vec[i]);
	printf("\n");fflush(stdout);
	int x,l;scanf("%d %d",&x,&l);
	return make_pair(x,l);
}
void solve()
{
	int n;scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	printf("? %d",n);
	for(int i=1;i<=n;i++)
		printf(" %d",i);
	printf("\n");fflush(stdout);
	int x,len;scanf("%d %d",&x,&len);
	int l=(len+1)/2-1,r=min(len,getdep(x,0))+1;
	int u=0;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		pair<int,int>pr=query(x,mid);
		if(pr.second==len)u=pr.first,l=mid;
		else r=mid;
	}
	printf("! %d %d\n",u,query(u,len).first);
	fflush(stdout);
	string blabla;
	cin>>blabla;
	for(int i=1;i<=n;i++)
		e[i].clear();
	return ;
}
int main()
{
	int t;scanf("%d",&t);
	while(t--)
		solve();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1
#define L t[x].l
#define R t[x].r

const int N=555555,M=8888888;
      ll MOD=10007;
      int intINF=int(1e9);
      ll llINF=ll(1e18);
      db eps=1e-8;
      int dx[4]={-1,1,0,0};
      int dy[4]={0,0,-1,1};
      long double pi=acos(-1.0L);
     // ld s2=sqrt(2.0);

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

inline char nc()
{
    static char buf[100000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

int rd()
{
    int x=0; char ch=nc();
    while(ch<'0'||ch>'9') ch=nc();
    while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=nc();
    return x;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}

ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int head[N],vet[N],nxt[N],dis[N],n,tot;
VI d[N],c;
char s[N];

void predo()
{
}

void add(int a,int b)
{
    nxt[++tot]=head[a];
    vet[tot]=b;
    head[a]=tot;
}

PII query(VI a)
{
    printf("? %d",(int)a.size());
    for(auto t:a) printf(" %d",t);
    printf("\n");
    fflush(stdout);
    int x=read(),y=read();
    return MP(x,y);
}

void init()
{
    n=read();
    rep(i,1,n) head[i]=0;
    tot=0;
    rep(i,1,n-1)
    {
        int x=read(),y=read();
        add(x,y);
        add(y,x);
    }
}

void dfs(int u,int pre)
{
    int e=head[u];
    while(e)
    {
        int v=vet[e];
        if(dis[v]!=intINF&&v!=pre)
        {
            dis[v]=dis[u]+1;
            dfs(v,u);
        }
        e=nxt[e];
    }
}

void solve()
{
    c.clear();
    rep(i,1,n) c.pb(i);
    PII tmp=query(c);
    int root=tmp.fi,len=tmp.se;
    rep(i,1,n) dis[i]=intINF;
    dis[root]=0;
    dfs(root,0);
    rep(i,0,n) d[i].clear();
    rep(i,1,n) d[dis[i]].pb(i);

    int l=1,r=len/2,u=root;
    if(r*2<len) r++;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        c.clear();
        for(auto t:d[mid]) c.pb(t);
        PII tmp=query(c);
        if(tmp.se==len){u=tmp.fi;l=mid+1;}
         else r=mid-1;
    }

    rep(i,1,n) dis[i]=0;
    dfs(u,0);
    c.clear();
    rep(i,1,n)
     if(dis[i]==len) c.pb(i);
    tmp=query(c);
    int v=tmp.fi;
    printf("! %d %d\n",u,v);
    fflush(stdout);
    scanf("%s",s+1);
}

int main()
{
    //freopen("1.in","r",stdin);
    int cas=read();
    //int cas=1;
    predo();
    while(cas--)
    {
       init();
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1
#define L t[x].l
#define R t[x].r

const int N=555555,M=8888888;
      ll MOD=10007;
      int intINF=int(1e9);
      ll llINF=ll(1e18);
      db eps=1e-8;
      int dx[4]={-1,1,0,0};
      int dy[4]={0,0,-1,1};
      long double pi=acos(-1.0L);
     // ld s2=sqrt(2.0);

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

inline char nc()
{
    static char buf[100000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

int rd()
{
    int x=0; char ch=nc();
    while(ch<'0'||ch>'9') ch=nc();
    while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=nc();
    return x;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}

ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int head[N],vet[N],nxt[N],dis[N],n,tot;
VI d[N],c;
char s[N];

void predo()
{
}

void add(int a,int b)
{
    nxt[++tot]=head[a];
    vet[tot]=b;
    head[a]=tot;
}

PII query(VI a)
{
    printf("? %d",(int)a.size());
    for(auto t:a) printf(" %d",t);
    printf("\n");
    fflush(stdout);
    int x=read(),y=read();
    return MP(x,y);
}

void init()
{
    n=read();
    rep(i,1,n) head[i]=0;
    tot=0;
    rep(i,1,n-1)
    {
        int x=read(),y=read();
        add(x,y);
        add(y,x);
    }
}

void dfs(int u,int pre)
{
    int e=head[u];
    while(e)
    {
        int v=vet[e];
        if(!dis[v]&&v!=pre)
        {
            dis[v]=dis[u]+1;
            dfs(v,u);
        }
        e=nxt[e];
    }
}

void solve()
{
    c.clear();
    rep(i,1,n) c.pb(i);
    PII tmp=query(c);
    int root=tmp.fi,len=tmp.se;
    rep(i,1,n) dis[i]=0;
    dis[root]=0;
    dfs(root,0);
    rep(i,0,n) d[i].clear();
    rep(i,1,n) d[dis[i]].pb(i);

    int l=0,r=len/2,u=root;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        c.clear();
        for(auto t:d[mid]) c.pb(t);
        PII tmp=query(c);
        if(tmp.se==len){u=tmp.fi;l=mid+1;}
         else r=mid-1;
    }

    rep(i,1,n) dis[i]=0;
    dfs(u,0);
    c.clear();
    rep(i,1,n)
     if(dis[i]==len) c.pb(i);
    tmp=query(c);
    int v=tmp.fi;
    printf("! %d %d\n",u,v);
    fflush(stdout);
    scanf("%s",s+1);
}

int main()
{
    //freopen("1.in","r",stdin);
    int cas=read();
    //int cas=1;
    predo();
    while(cas--)
    {
       init();
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1
#define L t[x].l
#define R t[x].r

const int N=555555,M=8888888;
      ll MOD=10007;
      int intINF=int(1e9);
      ll llINF=ll(1e18);
      db eps=1e-8;
      int dx[4]={-1,1,0,0};
      int dy[4]={0,0,-1,1};
      long double pi=acos(-1.0L);
     // ld s2=sqrt(2.0);

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

inline char nc()
{
    static char buf[100000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

int rd()
{
    int x=0; char ch=nc();
    while(ch<'0'||ch>'9') ch=nc();
    while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=nc();
    return x;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}

ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int head[N],vet[N],nxt[N],dis[N],n,tot;
VI d[N],c;
char s[N];

void predo()
{
}

void add(int a,int b)
{
    nxt[++tot]=head[a];
    vet[tot]=b;
    head[a]=tot;
}

PII query(VI a)
{
    printf("? %d",(int)a.size());
    for(auto t:a) printf(" %d",t);
    printf("\n");
    fflush(stdout);
    int x=read(),y=read();
    return MP(x,y);
}

void init()
{
    n=read();
    rep(i,1,n) head[i]=0;
    tot=0;
    rep(i,1,n-1)
    {
        int x=read(),y=read();
        add(x,y);
        add(y,x);
    }
}

void dfs(int u,int pre)
{
    int e=head[u];
    while(e)
    {
        int v=vet[e];
        if(!dis[v]&&v!=pre)
        {
            dis[v]=dis[u]+1;
            dfs(v,u);
        }
        e=nxt[e];
    }
}

void solve()
{
    c.clear();
    rep(i,1,n) c.pb(i);
    PII tmp=query(c);
    int root=tmp.fi,len=tmp.se;
    rep(i,1,n) dis[i]=0;
    dis[root]=0;
    dfs(root,0);
    rep(i,0,n) d[i].clear();
    rep(i,1,n) d[dis[i]].pb(i);

    int l=1,r=len/2,u=root;
    if(r*2<len) r++;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        c.clear();
        for(auto t:d[mid]) c.pb(t);
        PII tmp=query(c);
        if(tmp.se==len){u=tmp.fi;l=mid+1;}
         else r=mid-1;
    }

    rep(i,1,n) dis[i]=0;
    dfs(u,0);
    c.clear();
    rep(i,1,n)
     if(dis[i]==len) c.pb(i);
    tmp=query(c);
    int v=tmp.fi;
    printf("! %d %d\n",u,v);
    fflush(stdout);
    scanf("%s",s+1);
}

int main()
{
    //freopen("1.in","r",stdin);
    int cas=read();
    //int cas=1;
    predo();
    while(cas--)
    {
       init();
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1
#define L t[x].l
#define R t[x].r

const int N=555555,M=8888888;
      ll MOD=10007;
      int intINF=int(1e9);
      ll llINF=ll(1e18);
      db eps=1e-8;
      int dx[4]={-1,1,0,0};
      int dy[4]={0,0,-1,1};
      long double pi=acos(-1.0L);
     // ld s2=sqrt(2.0);

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

inline char nc()
{
    static char buf[100000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

int rd()
{
    int x=0; char ch=nc();
    while(ch<'0'||ch>'9') ch=nc();
    while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=nc();
    return x;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}

ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int head[N],vet[N],nxt[N],dis[N],n,tot;
VI d[N],c;
char s[N];

void predo()
{
}

void add(int a,int b)
{
    nxt[++tot]=head[a];
    vet[tot]=b;
    head[a]=tot;
}

PII query(VI a)
{
    printf("? %d",(int)a.size());
    for(auto t:a) printf(" %d",t);
    printf("\n");
    fflush(stdout);
    int x=read(),y=read();
    return MP(x,y);
}

void init()
{
    n=read();
    rep(i,1,n) head[i]=0;
    tot=0;
    rep(i,1,n-1)
    {
        int x=read(),y=read();
        add(x,y);
        add(y,x);
    }
}

void dfs(int u,int pre)
{
    int e=head[u];
    while(e)
    {
        int v=vet[e];
        if(dis[v]==intINF&&v!=pre)
        {
            dis[v]=dis[u]+1;
            dfs(v,u);
        }
        e=nxt[e];
    }
}

void solve()
{
    c.clear();
    rep(i,1,n) c.pb(i);
    PII tmp=query(c);
    int root=tmp.fi,len=tmp.se;
    rep(i,1,n) dis[i]=intINF;
    dis[root]=0;
    dfs(root,0);
    rep(i,0,n) d[i].clear();
    rep(i,1,n) d[dis[i]].pb(i);

    int l=1,r=len/2,u=root;
    if(r*2<len) r++;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        c.clear();
        for(auto t:d[mid]) c.pb(t);
        PII tmp=query(c);
        if(tmp.se==len){u=tmp.fi;l=mid+1;}
         else r=mid-1;
    }

    rep(i,1,n) dis[i]=intINF;
    dis[u]=0;
    dfs(u,0);
    c.clear();
    rep(i,1,n)
     if(dis[i]==len) c.pb(i);
    tmp=query(c);
    int v=tmp.fi;
    printf("! %d %d\n",u,v);
    fflush(stdout);
    scanf("%s",s+1);
}

int main()
{
    //freopen("1.in","r",stdin);
    int cas=read();
    //int cas=1;
    predo();
    while(cas--)
    {
       init();
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1
#define L t[x].l
#define R t[x].r

const int N=555555,M=8888888;
      ll MOD=10007;
      int intINF=int(1e9);
      ll llINF=ll(1e18);
      db eps=1e-8;
      int dx[4]={-1,1,0,0};
      int dy[4]={0,0,-1,1};
      long double pi=acos(-1.0L);
     // ld s2=sqrt(2.0);

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

inline char nc()
{
    static char buf[100000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

int rd()
{
    int x=0; char ch=nc();
    while(ch<'0'||ch>'9') ch=nc();
    while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=nc();
    return x;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}

ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int head[N],vet[N],nxt[N],dis[N],n,tot;
VI d[N],c;
char s[N];

void predo()
{
}

void add(int a,int b)
{
    nxt[++tot]=head[a];
    vet[tot]=b;
    head[a]=tot;
}

PII query(VI a)
{
    printf("? %d",(int)a.size());
    for(auto t:a) printf(" %d",t);
    printf("\n");
    fflush(stdout);
    int x=read(),y=read();
    return MP(x,y);
}

void init()
{
    n=read();
    rep(i,1,n) head[i]=0;
    tot=0;
    rep(i,1,n-1)
    {
        int x=read(),y=read();
        add(x,y);
        add(y,x);
    }
}

void dfs(int u,int pre)
{
    int e=head[u];
    while(e)
    {
        int v=vet[e];
        if(dis[v]==intINF&&v!=pre)
        {
            dis[v]=dis[u]+1;
            dfs(v,u);
        }
        e=nxt[e];
    }
}

void solve()
{
    c.clear();
    rep(i,1,n) c.pb(i);
    PII tmp=query(c);
    int root=tmp.fi,len=tmp.se;
    rep(i,1,n) dis[i]=intINF;
    dis[root]=0;
    dfs(root,0);
    rep(i,0,n) d[i].clear();
    rep(i,1,n) d[dis[i]].pb(i);

    int l=len/2,r=len,u=root;
    if(l*2<len) l++;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        c.clear();
        for(auto t:d[mid]) c.pb(t);
        if((int)c.size()==0)
        {
            r=mid-1;
            continue;
        }
        PII tmp=query(c);
        if(tmp.se==len){u=tmp.fi;l=mid+1;}
         else r=mid-1;
    }

    rep(i,1,n) dis[i]=intINF;
    dis[u]=0;
    dfs(u,0);
    c.clear();
    rep(i,1,n)
     if(dis[i]==len) c.pb(i);
    tmp=query(c);
    int v=tmp.fi;
    printf("! %d %d\n",u,v);
    fflush(stdout);
    scanf("%s",s+1);
}

int main()
{
    //freopen("1.in","r",stdin);
    int cas=read();
    //int cas=1;
    predo();
    while(cas--)
    {
       init();
       solve();
    }
    return 0;
}