import java.io.*;
import java.util.*;
import java.text.*;

public class prob4 {
	public static String[] topRow = {"x.", "xx", "x.x", "xx", "xxx"}; ;
	public static String[] bottomRow = {"xx", "xx", "xxx", ".x", ".xx"};
	public static String[] letters = {"A", "B", "C", "D", "E"};
	public static boolean remainder = true;
	public static void main (String args[]) throws IOException{
		
		File in = new File("DATA4.txt");
		Scanner scan = new Scanner (in);
		
		File out = new File("OUT4.txt");
		PrintWriter pw = new PrintWriter(out);
		
		for(int i=0; i<5; i++){
			String top = scan.next();
			String bottom = scan.next();
			
			String finalWord=check(top, bottom);
			
			pw.println(finalWord);
			
		}
	pw.close();

}
	public static String check(String up, String down){
		if((up.length()<2)||(down.length()<2)){
			return "";
		}
		
		String word="";
		String letter="";
		
		for(int i=0; i<5; i++){
			int charLength=topRow[i].length();
		//	System.out.println(topRow[i].length()-1);
		//	System.out.println((up.substring(0, charLength))+" "+(down.substring(0, charLength)));
			if((topRow[i].equals(up.substring(0, charLength))) && (bottomRow[i].equals(down.substring(0, charLength)))){
				
				letter=letters[i];

				word=letter+check(up.substring(charLength), down.substring(charLength));

				return word;
				
			}
			
		}
		return word;
	}
}
