// Arup Guha
// 5/8/2019
// Solution to 2019 FHSPS Playoff Problem: Move Notation

import java.util.*;

public class move {

	final public static int N = 8;
	final public static char OPEN = '.';
	
	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 both boards.
			char[][] before = new char[N][];
			for (int i=0; i<N; i++)
				before[i] = stdin.next().toCharArray();
			
			char[][] after = new char[N][];
			for (int i=0; i<N; i++)
				after[i] = stdin.next().toCharArray();		
			
			// Find the two changed squares and output the move!
			System.out.println(convert(getFrom(before, after))+"-"+convert(getTo(before, after)));
		}
	}
	
	// Returns the location that used to have a piece that now does not (move starting location).
	public static int getFrom(char[][] before, char[][] after) {
		for (int i=0; i<N*N; i++) 
			if (before[i/N][i%N] != after[i/N][i%N] && after[i/N][i%N] == OPEN)
				return i;
		return -1;
	}
	
	// Returns the location that has changed after the move and isn't open after the move.
	public static int getTo(char[][] before, char[][] after) {
		for (int i=0; i<N*N; i++) 
			if (before[i/N][i%N] != after[i/N][i%N] && after[i/N][i%N] != OPEN)
				return i;
		return -1;
	}	
	
	// Returns the String version of location loc (0-63).
	public static String convert(int loc) {
		int row = N - loc/N;
		char col = (char)('A'+loc%N);
		return "" + col + row;
	}
}