// Arup Guha
// 3/27/2017
// Solution to COT 3100 Optional Program #1: Tromino Tiling

import java.util.*;

public class tromino {

	final public static char NOTDONE = '0';

	public static char fillChar;
	public static int n;
	public static char[][] grid;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=0; loop<numCases; loop++) {

			// Get inputl
			n = stdin.nextInt();
			int initX = stdin.nextInt()-1;
			int initY = stdin.nextInt()-1;

			// Set up grid for recursive call.
			grid = new char[1<<n][1<<n];
			for (int i=0; i<grid.length; i++) Arrays.fill(grid[i], NOTDONE);
			grid[initX][initY] = ' ';
			fillChar = 'A';

			// Fill it.
			go(0, 0, n, initX, initY);

			// Output result.
			print();
		}
	}

	public static void go(int topX, int topY, int size, int xHole, int yHole) {

		// Base case, one tromino to put in!
		if (size == 1) {

			// Put in this tile.
			fillOne(topX, topY, xHole, yHole);
			return;
		}

		// Here is the top left of the "middle" 2x2 box, where we must fill one L shaped tile.
		int sX = topX + (1<<(size-1)) - 1;
		int sY = topY + (1<<(size-1)) - 1;

		// Get exact coordinate of our skipped hole, corresponding to middle of quadrant with real skipped hole.
		int xQuad = (xHole-topX)/(1<<(size-1));
		int yQuad = (yHole-topY)/(1<<(size-1));
		int skipX = sX + xQuad;
		int skipY = sY + yQuad;

		// Now, fill middle tile.
		fillOne(sX, sY, skipX, skipY);

		// Now go through 4 quadrants for recursive calls.
		for (int i=0; i<2; i++) {
			for (int j=0; j<2; j++) {

				// Where the hole usually is, in middle.
				int thisXHole = sX+i;
				int thisYHole = sY+j;

				// Special case - this was passed in hole
				if (i == xQuad && j == yQuad) {
					thisXHole = xHole;
					thisYHole = yHole;
				}

				// Appropriate recursive call.
				go(topX+(1<<(size-1))*i, topY+(1<<(size-1))*j, size-1, thisXHole, thisYHole);
			}
		}
	}

	// Fills in one tile in 2 x 2 square with top left coordinate (topX, topY), skipping (skipX, skipY).
	public static void fillOne(int topX, int topY, int skipX, int skipY) {

		// Here we fill 3 of 4 squares with the current fill char. Skip the "blank".
		for (int i=topX; i<topX+2; i++)
			for (int j=topY; j<topY+2; j++)
				if (i != skipX || j != skipY)
					grid[i][j] = fillChar;

		// So next print is fine.
		fillChar = getNext(fillChar);
	}

	// Just returns the next fill character after ch.
	public static char getNext(char ch) {
		return ch < 'Z' ? (char)(ch+1) : 'A';
	}

	// Prints the grid.
	public static void print() {
		for (int i=0; i<grid.length; i++)
			System.out.println(new String(grid[i]));
		System.out.println();
	}
}