/**
 *    author:  tourist
 *    created: 05.11.2025 20:03:34
**/
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int tt, n;
  cin >> tt >> n;
  while (tt--) {
    vector<vector<pair<int, int>>> p(2);
    map<pair<int, int>, int> mp;
    int target = -1;
    auto Ask = [&](int x, int y) {
      cout << "? " << x << " " << y << endl;
      char c;
      cin >> c;
      int ret = (c == 'B' ? 0 : 1);
      if (target == -1) {
        target = ret;
      }
      mp[{x, y}] |= 4;
      if (ret == target) {
        p[ret].emplace_back(x, y);
        for (int dx = -1; dx <= 1; dx++) {
          for (int dy = -1; dy <= 1; dy++) {
            mp[{x + dx, y + dy}] |= 1 << ret;
          }
        }
      }
    };
    int x = 0;
    Ask(0, 0);
    while (true) {
      if (int(p[0].size()) == n) {
        cout << "! B" << " ";
        for (int i = 0; i < n; i++) {
          cout << p[0][i].first << " " << p[0][i].second << " \n"[i == n - 1];
        }
        cout.flush();
        break;
      }
      if (int(p[1].size()) == n) {
        cout << "! W" << " ";
        for (int i = 0; i < n; i++) {
          cout << p[1][i].first << " " << p[1][i].second << " \n"[i == n - 1];
        }
        cout.flush();
        break;
      }
      int max_val = -1;
      pair<int, int> best_pt;
      for (auto& [pt, val] : mp) {
        if (val < 4 && val > max_val) {
          max_val = val;
          best_pt = pt;
        }
      }
      if (max_val <= 0) {
        p[0].clear();
        p[1].clear();
        mp.clear();
        target = -1;
        x += 10 * n;
        Ask(x, 0);
        continue;
      }
      Ask(best_pt.first, best_pt.second);
    }
  }
  return 0;
}
