// A Figure on Surface
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

string str;
int i,xbase,ybase,ans;
void solve(){
	char ch;
	switch(ans){
		case 11:
			ch = 'A';
			break;
		case 0:
			ch = 'B';
			break;
		case 6:
			ch = 'C';
			break;
		case -110:
			ch = 'D';
			break;
		case 31:
			ch = 'E';
			break;
		case 110:
			ch = 'F';
			break;
		default:
			ch = 'G';
			break;
	}
	cout << endl << ans << endl;
	cout << ch << endl;
}
void init(){
	i = 0;
	xbase = ybase = -1;
	ans = 0;
}
int main(){
	while(cin >> str){
		for(int j=0;j<8;j++){
			if(str[j]=='1'){
				if(xbase == -1){
					xbase = j;
					ybase = i;
				} else {
					ans += (j-xbase)*pow(10,i-ybase);
				}
			}
		}
		i++;
		if(i==7){
			solve();
			init();
		}
	}
}