#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;

int main(void) {
	int i;
	char field[65];
	char image[8][26] = {
		"1100000011",
		"1000000010000000100000001",
		"1111",
		"1000000110000001",
		"11000000011",
		"100000001100000001",
		"110000011"
	};

	while (cin >> field) {
		//cout<<field;
		for (i = 1; i < 8; i++) {
			cin >> image[7];
			strcat(field, image[7]);
			//cout<<field;
		}
		//cout<<endl;
		field[64] = '\0';
		for (i = 0; i < 7; i++) {
			char *pFind = strstr(field, image[i]);
			//cout<<pFind<<endl;
			if (pFind != NULL) {
				cout << char('A' + i) << endl;
				break;
			}
		}
	}

	return 0;
}

