import java.io.*;
import java.util.*;
import java.math.*;

public class q3 
{
	public static void main(String[] args)throws IOException
	{
		BufferedReader bf = new BufferedReader(new FileReader("DATA4.txt"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("OUT4.txt")));
		
		String s[] = {"x(x).(x)", "x(x)x(x)", "x(x).(x)x(x)", "x(.)x(x)", "x(.)x(x)x(x)"};
		String s2[] = {")x(.)x(x", ")x(x)x(x", ")x(x)x(.)x(x", ")x(x).(x", ")x(x)x(x).(x"};
		
		for (int i = 0; i < 5; i++)
		{
			String k = bf.readLine();
			String d = bf.readLine();
			String t = "";
			String res = "";
			
			for (int j = 0; j < k.length(); j++)
				t += k.charAt(j) + "(" + d.charAt(j) + ")";

			String r = "";
			
			for (int j = t.length() - 1; j >= 0; j--)
				r += t.charAt(j);
			
			String map = "ABCDE";
			int dif = 8;
			
			top:
			while (r.length() > 1)
			{
				String test = r.substring(0, dif);
				for (int j = 0; j < 5; j++)
					if (test.equals(s2[j]))
					{
						res += map.charAt(j);
						r = r.substring(dif);
						
						if (t.length() == 12)
							dif = 12;
						else
							dif = 8;
						continue top;
					}
				
				if (dif == 8)
					dif = 12;
				else
					break;
			}

			String fin = "";
			
			for (int j = res.length() - 1; j >= 0; j--)
				fin += res.charAt(j);
			
			out.println(fin);
		}
		
		out.close();
	}
	
}
