import std.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.string;
import std.numeric;
string[] t = ["1100000011", "1000000010000000100000001", "1111", "01000000110000001", "11000000011", "100000001100000001", "0110000011"];
void main() {
	string s;
	while( (s=readln()).length != 0 ){
		string m = s.strip();
		for (int i=1;i<8;i++){
			m ~= readln().strip();
		}
		for (char i=0;i<7;i++){
			if(m.indexOf(t[i])!=-1){
				writefln("%c",to!char('A'+i));
				break;
			}
		}
	}
}