#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

/*
A 2*2 B 1*4 C 4*1 D 01 E 110 F 10 G 011
                    11   011   11   110
                    10         01
*/

int main() {
	while (true) {
		string in[4];
		string tmp;
		int j=0;
		for (int i=0; i<8; i++) {
			cin >> tmp;
			if (tmp != "00000000") {
				in[j] = tmp;
				j++;
			}
		}
		scanf("\n");
		if (j == 4) {
			cout << "B" << endl;
		} else if (j == 1) {
			cout << "C" << endl;
		} else if (j == 2) {
			if (in[0] == in[1]) {
				cout << "A" << endl;
			} else if (in[0] > in[1]) {
				cout << "E" << endl;
			} else {
				cout << "G" << endl;
			}
		} else {
			if (in[0] > in[1]) {
				cout << "F" << endl;
			} else {
				cout << "D" << endl;
			}
		}
	}
	return 0;
}