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

int main(){
	ios_base::sync_with_stdio(false), cin.tie(nullptr);
	mt19937 mt_test(48);
	int T;
	cin >> T;
	int N;
	cin >> N;
	int nq = 0;
	while(T--){
		auto ask = [&](int x, int y) -> int {
			cout << "? " << x << ' ' << y << '\n';
			cout << flush;
			nq++;
			// return mt_test() & 1;
			char c;
			cin >> c;
			if(c == '0') exit(0);
			return c == 'W';
		};
		int X = 1000;

		int bx = 0;
		int by = 0;
		while(true){
			vector<set<pair<int,int> >> found(2);
			vector<set<pair<int,int> >> cand(2);

			queue<pair<int,int>> q;
			{
				int cx = bx;
				int cy = by;
				while(found[0].empty() || found[1].empty()){
					found[ask(cx, cy)].insert({cx, cy});
					cx++;
				}
				for(int c = 0; c < 2; c++){
					for(auto [x, y] : found[c]){
						for(int dx : {-1, 0, 1}){
							for(int dy : {-1, 0, 1}){
								int nx = x+dx;
								int ny = y+dy;
								cand[c].insert({nx, ny});
							}
						}
					}
				}
				for(auto [x, y] : cand[0]){
					if(cand[1].count({x, y})){
						q.push({x, y});
					}
				}
			}
			while(!q.empty()){
				for(int c = 0; c < 2; c++){
					if((int)found[c].size() >= N){
						cout << "! " << "BW"[c];
						int cnt = 0;
						for(auto [x, y] : found[c]){
							cout << ' ' << x << ' ' << y;
							cnt++;
							if(cnt == N) break;
						}
						cout << '\n';
						cout << flush;
						goto done;
					}
				}
				auto [x, y] = q.front();
				q.pop();
				if(found[0].count({x, y}) || found[1].count({x, y})) continue;
				int c = ask(x, y);
				found[c].insert({x, y});
				for(int dx : {-1, 0, 1}){
					for(int dy : {-1, 0, 1}){
						int nx = x+dx;
						int ny = y+dy;
						cand[c].insert({nx, ny});
						if(cand[1^c].count({nx, ny})) q.push({nx, ny});
					}
				}
			}
			bx += X;
			if(bx >= int(1e6) - 2 * X){
				bx = 0;
				by += X;
			}
		}
		done:;
	}
}
