// Arup Guha
// 3/13/2018
// Solution to 2018 UCF HS Contest Problem: Tic-Tac-Toe Plus

import java.util.*;

public class tic {

	// I just need to check in these four directions for 3 or 4 in a row.
	final public static int[] DX = {0,1,1,1};
	final public static int[] DY = {1,1,0,-1};
	final public static int N = 4;

	// Grid info.
	public static int threeBonus;
	public static int fourBonus;
	public static int[][] grid;
	public static int[] memo;

	// Pre-comp which masks have 3 and 4 in a row.
	public static boolean[] hasThree;
	public static boolean[] hasFour;

	public static void main(String[] args) {

		// Do a pre-comp here for each board position.
		hasThree = new boolean[1<<(N*N)];
		hasFour = new boolean[1<<(N*N)];
		for (int i=0; i<(1<<(N*N)); i++) {
			hasThree[i] = comp(i, N-1);
			hasFour[i] = comp(i, N);
		}

		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=nC; loop++) {

			// Get the grid.
			threeBonus = stdin.nextInt();
			fourBonus = stdin.nextInt();
			grid = new int[N][N];
			for (int i=0; i<N; i++)
				for (int j=0; j<N; j++)
					grid[i][j] = stdin.nextInt();

			// Get Alex's best score.
			memo = new int[1<<(N*N)];
			Arrays.fill(memo, -1);
			int max = go(0);

			// Header.
			System.out.print("Game #"+loop+": ");

			// Output appropriately.
			if (max > 0)
				System.out.println("Alex wins.");
			else if (max < 0)
				System.out.println("Barb wins.");
			else
				System.out.println("It's a draw.");
		}
	}

	public static int go(int mask) {

		// Base cases - we've done this before or a completed board.
		if (memo[mask] != -1) return memo[mask];
		if (Integer.bitCount(mask) == N*N) return 0;

		// Hopefully no one can do this bad =)
		int res = -1000000000;

		// Try each possible move.
		for (int i=0; i<N*N; i++) {

			// Can't move here.
			if ((mask & (1<<i)) != 0) continue;

			// This is my best score if I go in slot i.
			int tmp = grid[i/N][i%N] + getThree(mask, i) + getFour(mask, i) - go(mask|(1<<i));

			// Take the best result.
			res = Math.max(res, tmp);
		}

		// Store and return.
		return memo[mask] = res;
	}

	// Returns threeBonus iff adding (1<<bit) to mask gives the player three
	// in a row for the first time. Returns 0 otherwise.
	public static int getThree(int mask, int bit) {
		return !hasThree[mask] && hasThree[mask|(1<<bit)] ? threeBonus : 0;
	}

	// Returns fourBonus iff adding (1<<bit) to mask gives the player four
	// in a row for the first time. Returns 0 otherwise.
	public static int getFour(int mask, int bit) {
		return !hasFour[mask] && hasFour[mask|(1<<bit)] ? fourBonus : 0;
	}

	public static boolean comp(int mask, int streak) {

		// Try each starting square.
		for (int i=0; i<N; i++) {
			for (int j=0; j<N; j++) {

				// Try each direction.
				for (int dir=0; dir<DX.length; dir++) {

					// End of streak.
					int eX = i + (streak-1)*DX[dir];
					int eY = j + (streak-1)*DY[dir];

					// No need to check, goes out of bounds.
					if (!inbounds(eX,eY)) continue;

					int cnt = 0;

					// Now, go through the bits.
					for (int k=0; k<streak; k++) {

						// Here is the location.
						int myx = i + k*DX[dir];
						int myy = j + k*DY[dir];
						int loc = N*myx + myy;

						// This will add it in iff the bit is on.
						cnt += (mask & (1<<loc));
					}

					// This means we found a streak of the appropriate length.
					if (Integer.bitCount(cnt) == streak) return true;
				}
			} // end j
		} // end i

		// If we get here, we found nothing.
		return false;
	}

	public static boolean inbounds(int x, int y) {
		return x >= 0 && x < N && y >= 0 && y < N;
	}
}