// Arup Guha
// Started in contest, finished on 4/8/2020
// Solution to 2020 Code Jam Qualification Problem: ESAb ATAd

/*** This is pretty ugly, I iterated a bunch in the contest just
     to get the small case, and did so on the large after contest.
	 Part of the problem is that I am really bad testing interactive
	 problems. Also, I just let it get unwieldy. So, the code itself 
	 is bad to look at but here is the strategy in English:
	 
	 1) Sample the first five and last five bits.
	 2) Each subsequent turn, you sample 2 bits that have previously
	    been sampled (though sometimes 1), to determine what changed
		was made from the last time.
	 3) Change all the previous bits accordingly, so that the new bits
	    are valid.
	 4) Sample 8 more bits, positions [s, s+3] and [n-2-s,n+1-s], where
	    s is the earliest bit you haven't sampled yet.
		
	 One trick is that at first you might have the first five bits match
	 the last five, so there's no way to differentiate 
	 between the xor case and the xor+flip case, as well as the normal case
	 and the flip case. This same coalescing of cases occurs if the end bits
	 are perfectly "opposite" to the beginning ones.
	 
	 So, let's say s is the earliest bit you haven't sampled. The goal is to
	 find 2 bit locations x, and y where x < s and y < s such that exactly
	 1 of the pairs (x, n+1-x) and (y, n+1-y) are the same bit and 1 of the pairs
     has different bits. So, in subsequent turns, even if you only sampled 1 bit
     earlier (which happens in the equality case), you may have to sample 2 bits
     since now, we can differentiate between the cases, and need to.
***/	 
	  
	 
	 

import java.util.*;

public class d {
	
	public static int n;
	public static int[][] info;

	public static void main(String[] args) {
	
		// Get basic input.
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		n = stdin.nextInt();
		
		// Process each case.
		for (int loop=0; loop<nC; loop++) {
			
			// I wrote this in contest, so I kept it...
			if (n <= 20) {
				
				info = new int[2][n];
				for (int i=0; i<2; i++) Arrays.fill(info[i], -1);
			
				// This is all of the raw data.
				for (int rnd=0; rnd<n/10; rnd++) {
				
					for (int i=0; i<5; i++) {
						System.out.println(5*rnd+i+1);
						System.out.flush();
						info[rnd][5*rnd+i] = stdin.nextInt();
					}
				
					for (int i=0; i<5; i++) {
						System.out.println(n-(5*rnd+i));
						System.out.flush();
						info[rnd][n-(5*rnd+i)-1] = stdin.nextInt();
					}
				}				
				
				// Put result here.
				int[] res = new int[n];
				
				for (int rnd=0; rnd<n/10; rnd++) {
				
					// Get two bits.
					ArrayList<Integer> sample = getSample(5*rnd, rnd);
					int[] ans = new int[sample.size()];
					for (int i=0; i<ans.length; i++) {
						System.out.println(sample.get(i)+1);
						System.out.flush();
						ans[i] = stdin.nextInt();
					}
				
					// assign xor and flip.
					int xor = ans[0] == info[rnd][sample.get(0)] ? 0 : 1;
	
					// Flip changes based on xor...
					int flip = 0;
					if (sample.size() > 1) {
						flip = ans[1] == info[rnd][sample.get(1)] ? 0 : 1;
						flip = flip^xor;
					}
					
					// Make the changes directly.				
					for (int i=5*rnd; i<5*rnd+5; i++) {
						int loc = flip == 0 ? i : n-1-i;
						res[loc] = xor^info[rnd][i];
					}
					for (int i=n-(5*rnd+5); i<n-(5*rnd); i++) {
						int loc = flip == 0 ? i : n-1-i;
						res[loc] = xor^info[rnd][i];
					}					
				}
				
				// Here is our guess.
				for (int i=0; i<n; i++)
					System.out.print(res[i]);
				System.out.println();
				System.out.flush();
				String j = stdin.next();
				if (j.equals("N")) break;
			}
			
			// Large case...
			else {
				
				int[] fAns = new int[n];
				
				// Round one is unique - get first 5.
				for (int i=0; i<5; i++) {
					System.out.println(i+1);
					System.out.flush();
					fAns[i] = stdin.nextInt();					
				}
				
				// And last five.
				for (int i=n-1; i>=n-5; i--) {
					System.out.println(i+1);
					System.out.flush();
					fAns[i] = stdin.nextInt();					
				}
				
				// i is starting bit for this "round"
				for (int i=5; i<n/2; i+=4) {
				
					// Our first 2 bits to sample...so we can fix all old bits.
					ArrayList<Integer> sample = getSample(fAns, i);
					
					// Get these two bits.
					int ask = 0;
					int[] tmp = new int[2];
					for (int j=0; j<sample.size(); j++) {
						System.out.println(sample.get(j)+1);
						System.out.flush();
						tmp[j] = stdin.nextInt();
					}
					ask += sample.size();
					
					// assign xor and flip.
					int xor = tmp[0] == fAns[sample.get(0)] ? 0 : 1;
				
					int flip = 0;
					if (sample.size() > 1) {
						flip = tmp[1] == fAns[sample.get(1)] ? 0 : 1;
						flip = flip^xor;
					}

					// Updates previous bits for current state.
					apply(fAns,xor,flip);
					
					// Get up to 8 more bits. In last "round", this just gets 2.
					int j;
					for (j=i; j<n/2 && j<i+4; j++) {
						System.out.println(j+1);
						System.out.flush();
						fAns[j] = stdin.nextInt();	
						System.out.println(n-j);
						System.out.flush();
						fAns[n-j-1] = stdin.nextInt();
						ask += 2;
					}
					
					// This is how we detect we are in the last round.
					if (j == n/2) break;
					
					// We have to ask in rounds of 10, so if we didn't use all of our
					// questions, just waste some here to get to 10.
					if (ask < 10) {
						int left = 10 - ask;
						for (j=0; j<left; j++) {
							System.out.println(1);
							System.out.flush();
							int junk = stdin.nextInt();
						}
					}
				}
				
				// Ta da!
				for (int i=0; i<n; i++)
					System.out.print(fAns[i]);
				System.out.println();
				System.out.flush();
				String jAns = stdin.next();
				if (jAns.equals("N")) break;				
			}
		}
	}
	
	// Applies the effect of xor and flip to fAns.
	public static void apply(int[] fAns, int xor, int flip) {
		
		// No change.
		if (flip == 0 && xor == 0) return;
		
		// We just XOR.
		if (flip == 0 && xor == 1) {
			for (int i=0; i<n; i++) fAns[i] = fAns[i]^1;
		}
		
		// We just flip.
		else if (flip == 1 && xor == 0) {
			for (int i=0; i<n/2; i++) {
				int tmp = fAns[i];
				fAns[i] = fAns[n-1-i];
				fAns[n-1-i] = tmp;
			}
		}
		
		// We do both.
		else {
			for (int i=0; i<n/2; i++) {
				int tmp = fAns[i];
				fAns[i] = fAns[n-1-i]^1;
				fAns[n-1-i] = tmp^1;
			}			
		}
	}
	
	public static ArrayList<Integer> getSample(int[] bits, int until) {
		
		// Always add the first one.
		ArrayList<Integer> res = new ArrayList<Integer>();
		res.add(0);
		boolean state = bits[0] == bits[n-1];
		
		// See if there's a bit with the opposite "flip" state...if so, add.
		for (int i=1; i<until; i++) {
			boolean curState = bits[i] == bits[n-1-i];
			if (curState != state) {
				res.add(i);
				break;
			}
		}
		
		// This is so the same bit comes first.
		if (!state && res.size() == 2) {
			int tmp = res.get(0);
			res.set(0, res.get(1));
			res.set(1, tmp);
		}
		
		return res;
	}
	
	// I wrote this for the small case and just decided to keep it.
	public static ArrayList<Integer> getSample(int s, int rnd) {
		
		// Always add the first one.
		ArrayList<Integer> res = new ArrayList<Integer>();
		res.add(s);
		boolean state = info[rnd][s] == info[rnd][n-1-s];
		
		for (int i=s+1; i<s+5; i++) {
			boolean curState = info[rnd][i] == info[rnd][n-1-i];
			if (curState != state) {
				res.add(i);
				break;
			}
		}
		
		if (!state && res.size() == 2) {
			int tmp = res.get(0);
			res.set(0, res.get(1));
			res.set(1, tmp);
		}
		
		return res;
		
	}	
}