// Arup Guha
// 1/20/2016
// Alternate Solution to 2016 Mercer Proposed Problem: Stones

import java.util.*;

public class prob8 {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {

			// Get case.
			int r = stdin.nextInt();
			int c = stdin.nextInt();
			int alice = 0, bob = 0;

			// even column case, where Bob wins the first r-1 rows.
			if (c%2 == 0) {

				// Playing all but the last spot, greedy parity on both sides.
				bob = r - 1 + c/2 - 1;
				alice = c/2;

				// In this case, the parity of the last row and column are same, so bob can win both.
				if ((r-1)%2 == (c/2-1)%2) bob += 2;

				// No matter what bob plays, he wins one, he loses one.
				else {
					alice++;
					bob++;
				}
			}

            // Odd columns, even rows. They alternate rows and columns.
			else if (r%2 == 0 && c%2 == 1) {

				// Playing all but the last spot, greedy parity on both sides.
				alice = r/2 + c/2;
				bob = r/2 - 1 + c/2;

				// Parity of last row and column is the same, bob can get both.
				if ((r/2-1)%2 == (c/2)%2) bob += 2;

				// No matter what bob plays, they split.
				else {
					bob++;
					alice++;
				}
			}

            // odd x odd case
			else {

				// Playing all but the last spot, greedy parity on both sides.
				alice = r/2 + c/2;
				bob = r/2 + c/2;

				// Parity of last row and column is the same, alice can get both.
				if ((r/2)%2 == (c/2)%2) alice += 2;

				// No matter what alice plays, they split.
				else {
					alice++;
					bob++;
				}
			}

			// Output result.
			System.out.println("Case #"+loop+":");
			System.out.println("Alice: "+alice+", Bob: "+bob);
			System.out.println();
		}
	}
}
