import java.util.*;
import java.io.*;

public class problem4{
    public static void main(String[] args) throws Exception{
        Scanner in = new Scanner(new File("DATA4.txt"));
        PrintWriter out = new PrintWriter(new FileWriter("OUT4.txt"));
        String line1[] = {"x.", "xx", "x.x", "xx", "xxx"};
        String line2[] = {"xx", "xx", "xxx", ".x", ".xx"};
        char[] array = {'A', 'B', 'C', 'D', 'E'};
        Stack<String> prev1;
        Stack<String> prev2;
        String input1;
        String input2;
        String output;
        for(int i = 0; i < 5; i++){
            output = "";
            input1 = in.nextLine();
            input2 = in.nextLine();
            String temp1 = input1;
            String temp2 = input2;
            int counter = 0;
            int index[] = new int[30];
            boolean replaced = false;
            prev1 = new Stack<String>();
            prev2 = new Stack<String>();
            //System.out.println(i + "i");
            for(int j = 0; j < 5 && temp1.length()!=0; j++){                
                if(!replaced && j == 4){
                    j = index[counter];
                    temp1 = prev1.pop();
                    temp2 = prev2.pop();
                    counter--;
                   // System.out.println(j + "jjj");
                }
                replaced = false;
                if((temp1.indexOf(line1[j]) == 0) && (temp2.indexOf(line2[j]) == 0) && (line1[j].length() <= temp1.length())){
                   // System.out.println(line1[j]);
                    //System.out.println(j +"j");
                    counter++;
                    prev1.push(temp1);
                    prev2.push(temp2);
                    temp1 = temp1.substring(line1[j].length());
                    temp2 = temp2.substring(line1[j].length());
                  //  System.out.println(temp1);
                  //  System.out.println(temp2);
                    
                    replaced = true;
                    index[counter] = j + 1;
                   // System.out.println(index[counter] + "c");
                    j = -1;
                }
            }
            for(int j = 0; j < 30; j++){
                if(index[j] != 0)
                    output += array[index[j]-1];
            }
            out.println(output);
        }
        out.close();
    }
}
