#include<iostream>
#include<string>
using namespace std;

string s[10];

int main() {
	int t = 0;
	int r = 0;
	for (int i = 0; i < 9; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < 9; i++) {
		for (int j = 0; j < 9;j++)
		{
			if (s[i][j] == '1') {
				if (t == 0)t = j;
				r += j;
			}
		}
	}
	r -= 4*t;
	if (r == 19)cout << 'A' << endl;
	else if (r == 48)cout << 'B' << endl;
	else if (r == 6)cout << 'C' << endl;
	else if (r == 30)cout << 'D' << endl;
	else if (r == 20)cout << 'E' << endl;
	else if (r == 34)cout << 'F' << endl;
	else if (r == 16)cout << 'G' << endl;
}