#include <bits/stdc++.h>
using namespace std;
int query(vector<int> a, vector<int> b) {
  cout << "? " << a.size() << " " << b.size() << endl;
  for (int x : a) cout << x << " ";
  cout << endl;
  for (int x : b) cout << x << " ";
  cout << endl;
  string s;
  cin >> s;
  if (s[0] == 'F')
    return 1;
  else if (s[0] == 'S')
    return -1;
  else
    return 0;
}
mt19937 rng(412412412);
const int K = 30;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> all;
    for (int i = 1; i <= n; i++) all.push_back(i);
    shuffle(all.begin(), all.end(), rng);
    int mx = all[0];
    for (int i = 1; i < K && i < all.size(); i++) {
      if (query({mx}, {all[i]}) < 0) mx = all[i];
    }
    all.clear();
    all.push_back(mx);
    for (int i = 1; i <= n; i++)
      if (i != mx) all.push_back(i);
    int x = 1;
    for (x = 1; x * 2 <= n; x *= 2) {
      vector<int> a, b;
      for (int i = 0; i < x; i++) {
        a.push_back(all[i]);
        b.push_back(all[i + x]);
      }
      if (query(a, b) > 0) break;
    }
    int l = x, r = min(2 * x, n);
    for (int z = x / 2; z > 0; z /= 2) {
      if (r - l < z) continue;
      vector<int> a, b;
      for (int i = 0; i < z; i++) {
        a.push_back(all[i]);
        b.push_back(all[l + i]);
      }
      if (query(a, b) > 0)
        r = l + z;
      else
        l = l + z;
    }
    cout << "! " << all[l] << endl;
  }
}
