#include <iostream>
#include <vector>

using namespace std;

int ask(const vector<pair<int, int>>& cells) {
    if (cells.empty()) return 0;
    cout << "? " << cells.size();
    for (auto p : cells) {

        cout << " " << p.first + 1 << " " << p.second + 1;
    }
    cout << "\n";
    cout.flush(); 
    
    int ans;
    cin >> ans;
    return ans;
}

void solve() {

    vector<int> active_diags = {0, 1, 2, 3, 4, 5, 6, 7};
    int W = 33; 

    while (active_diags.size() > 1) {
        int mid = active_diags.size() / 2;
        vector<int> left_half(active_diags.begin(), active_diags.begin() + mid);
        vector<int> right_half(active_diags.begin() + mid, active_diags.end());
        
        vector<pair<int, int>> query_cells;
        for (int k : left_half) {
            for (int r = 0; r < 8; ++r) {
                query_cells.push_back({r, (r + k) % 8}); 
            }
        }
        
        int X = ask(query_cells);
        if (X > 4 * (int)left_half.size()) {
            active_diags = left_half;
            W = X;
        } else {
            active_diags = right_half;
            W = W - X;
        }
    }
    
    int target_k = active_diags[0];
        vector<pair<int, int>> D;
    for (int r = 0; r < 8; ++r) {
        D.push_back({r, (r + target_k) % 8});
    }
    

    int V[4];
    V[0] = ask({D[0], D[1]});
    V[1] = ask({D[2], D[3]});
    V[2] = ask({D[4], D[5]});
    V[3] = W - V[0] - V[1] - V[2];
    
    vector<pair<int, int>> ans;
    vector<int> one_pairs; 
    

    for (int i = 0; i < 4; ++i) {
        if (V[i] == 2) {
            ans.push_back(D[2 * i]);
            ans.push_back(D[2 * i + 1]);
        } else if (V[i] == 1) {
            one_pairs.push_back(i);
        }
    }
    

    while (ans.size() > 5) ans.pop_back();
    
    for (int p_idx : one_pairs) {
        if (ans.size() == 5) break;
        

        int v = ask({D[2 * p_idx]});
        if (v == 1) {
            ans.push_back(D[2 * p_idx]);
        } else {
            ans.push_back(D[2 * p_idx + 1]);
        }
    }
    

    cout << "!";
    for (int i = 0; i < 5; ++i) {
        cout << " " << ans[i].first + 1 << " " << ans[i].second + 1;
    }
    cout << "\n";
    cout.flush();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int T;
    if (cin >> T) {
        while (T--) {
            solve();
        }
    }
    return 0;
}
