import std.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.string;
import std.numeric;
string[] t = ["0110000000011", "01000000000100000000010000000001", "1111", "010000000011000000001", "01100000000011", "01000000000110000000001", "011000000011"];
void main() {
	string s;
	while( (s=readln()).length != 0 ){
		string m = "0000000000"~"0"~s.strip()~"0";
		for (int i=1;i<8;i++){
			m ~= "0" ~ readln().strip() ~ "0";
		}
		m~="0000000000";
		for (char i=0;i<7;i++){
			if(m.indexOf(t[i])!=-1){
				writefln("%c",to!char('A'+i));
				break;
			}
		}
	}
}