// Brian Crabtree
// 7/26/2011
// Solution to BHCSI Contest Problem: Arup

import java.util.Scanner;
import java.io.*;

public class arup
{
	public static void main(String[] args) throws IOException
	{
		//Create scanner
		Scanner in = new Scanner(new File("arup.in"));
		
		//Take in number of games
		int games = in.nextInt();
		
		//Create for loop to simulate number of games
		for(int g = 1; g <= games; g++)
		{
			//Take in rows and columns for the game
			int rows = in.nextInt();
			int cols = in.nextInt();
			
			//Figure out how many consecutive spaces are required to win the game
			int toWin = Math.min(rows, cols);
			
			//Create the 2D array for the board
			String[][] board = new String[rows][cols];
			
			//Read the game into the board array
			for(int x = 0; x < rows; x++)
			{
				for(int y = 0; y < cols; y++)
				{
					board[x][y] = in.next();
				}
			}
					
			//Create an integer to indicate the winner after checking the board
			int winner = 0;
			
			//for loop to tell the checkRow method to check each row for a winner, exits the loop if a winner is found
			for(int i = 0; i < board.length; i++)
			{
				
				//save the checkRow result to a temporary string
				String temp = checkRow(board[i].length, i, board);
				
				//check to see if the temporary string is an X or an O, then set the winner and exit the loop if it is.
				if(temp.equals("X"))
				{
					winner = 1;
					break;
				}
				else if(temp.equals("O"))
				{	
					winner = 2;
					break;
				}
			}
			
			//for loop to tell the checkRow method to check each row for a winner, exits the loop if a winner is found
			for(int i = 0; i < board[0].length; i++)
			{
				
				//save the checkRow result to a temporary string
				String temp = checkCol(board.length, i, board);
				
				//check to see if the temporary string is an X or an O, then set the winner and exit the loop if it is.
				if(temp.equals("X"))
				{
					winner = 1;
					break;
				}
				else if(temp.equals("O"))
				{	
					winner = 2;
					break;
				}
			}
			
			//Either print out a winner or a no winner game
			if(winner == 1)
				System.out.println("Game #" + g + ": Huzzah! X is victorious!");
			else if(winner == 2)
				System.out.println("Game #" + g + ": Success! O has conquered the board!");
			else
				System.out.println("Game #" + g + ": Oh no! Neither of the players won!");
			
			
		}
	}
	
	//Method to check a row for winners. Takes in number of consecutive boxes for a win, the row to check, and the board to look in
	public static String checkRow(int toWin, int row, String[][] board)
	{
		//variables to count consecutive "x" or "o"
		int xFound = 0;
		int oFound = 0;
		
		//loop to cycle through all of the positions in the row
		for(int x = 0; x < board[0].length; x++)
		{
			//If the position on the board is an "x" or an "o", it will add to which is found, and reset the other. If neither an "x" or an "o" is present, both will be reset.
			if(board[row][x].equals("X"))
			{
				xFound++;
				oFound = 0;
			}
			else if(board[row][x].equals("O"))
			{
				oFound++;
				xFound = 0;
			}
			else
			{
				xFound = 0;
				oFound = 0;
			}
			
			//if we ever hit these numbers, then we have a win.
			if(xFound >= toWin)
				return "X";
			else if(oFound >= toWin)
				return "O";			
		}
		

		return "-";
	}
	
	//Method to check a column for winners. Takes in number of consecutive boxes for a win, the column to check, and the board to look in
	public static String checkCol(int toWin, int col, String[][] board)
	{
		//variables to count consecutive "x" or "o"
		int xFound = 0;
		int oFound = 0;
		
		//loop to cycle through all of the positions in the column
		for(int x = 0; x < board.length; x++)
		{
			//If the position on the board is an "x" or an "o", it will add to which is found, and reset the other. If neither an "x" or an "o" is present, both will be reset.
			if(board[x][col].equals("X"))
			{
				xFound++;
				oFound = 0;
			}
			else if(board[x][col].equals("O"))
			{
				oFound++;
				xFound = 0;
			}
			else
			{
				xFound = 0;
				oFound = 0;
			}
			
			//if we ever hit these numbers, then we have a win.
			if(xFound >= toWin)
				return "X";
			else if(oFound >= toWin)
				return "O";		
		}
		
		return "-";
	}
	
}