#include<cstdio>
#include<cstring>

int main(){
	char p[7][18] = {"1100000011", "10000000100000001", "1111", "1000000110000001", "11000000011", "10000000110000000", "110000011"};
	char f[65];
	char t;
	while(1 + scanf("%c", &f[0])){
		for(int i = 1; i < 64; i++){
			scanf("%c", &t);
			if(t - 10){
				f[i] = t;
			}else{
				i--;
			}
		}
		f[64] = '\0';
		for(int i = 0; i < 7; i++){
			if(strstr(f, p[i])){
				printf("%c\n", i + 'A');
			}
		}
	}
	return 0;
}