// Arup Guha
// 10/1/2015
// Solution to 2003 UCF HS Contest Problem: Two X-Men

import java.util.*;

public class xmen {

	final public static int[] DX = {-1,-1,-1,0,0,1,1,1};
	final public static int[] DY = {-1,0,1,-1,1,-1,0,1};

	public static int r;
	public static int c;
	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=1; loop<=numCases; loop++) {

			// Read in grid.
			c = stdin.nextInt();
			r = stdin.nextInt();
			grid = new char[r][];
			for (int i=0; i<r; i++)
				grid[i] = stdin.next().toCharArray();

			int wolverine = getWScore();
			int cyclops = getCScore();

			// Case header.
			System.out.println("Combat "+loop+":");

			// Appropriate output - annoying...
			if (wolverine >= cyclops) {
				System.out.println("  Wolverine: "+wolverine);
				System.out.println("  Cyclops:   "+cyclops);
			}
			else {
				System.out.println("  Cyclops:   "+cyclops);
				System.out.println("  Wolverine: "+wolverine);
			}
			System.out.println();
		}
	}

	// Returns Wolverine's score.
	public static int getWScore() {

		int max = 0;

		// Try each spot.
		for (int i=0; i<r; i++) {
			for (int j=0; j<c; j++) {

				// Skip invalid ones.
				if (grid[i][j] == 'X') continue;

				// Count neighboring X's
				int cur = 0;
				for (int k=0; k<DX.length; k++)
					if (inbounds(i+DX[k], j+DY[k]) && grid[i+DX[k]][j+DY[k]] == 'X')
						cur++;
				// Update best.
				max = Math.max(max, cur);
			}
		}

		return max;
	}

	public static boolean inbounds(int x, int y) {
		return x >= 0 && x < r && y >= 0 && y < c;
	}

	// Returns Cyclops's score.
	public static int getCScore() {

		int max = 0;

		// Try each square.
		for (int i=0; i<r; i++) {
			for (int j=0; j<c; j++) {

				// Skip occupied ones.
				if (grid[i][j] == 'X') continue;

				// Try moving in direction k.
				for (int k=0; k<DX.length; k++) {

					int cur = 0;

					// Move in direction k step number of steps.
					for (int step=1;;step++) {

						int x = i + DX[k]*step;
						int y = j + DY[k]*step;

						// Time to get out.
						if (!inbounds(x,y)) break;

						if (grid[x][y] == 'X') cur++;
					}

					// Update best.
					max = Math.max(max, cur);
				}
			}
		}

		// This is the best.
		return max;
	}
}