#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int getPeace(string s, int& pos)
{
	int c = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s.substr(i, 1) == "1")
		{
			if (c == 0)
			{
				pos = i;
			}
			c++;
		}
	}
	return c;
}

int main()
{
	string s;
	string out = "";
	int p0 = -1;
	int pos0 = -1;
	for (int i = 0; cin >> s; )
	{
		int pos = -1;
		int p = getPeace(s, pos);

		if (out == "")
		{
			if (p == 4)
			{
				out = "C";
			}
			else if (p == 2)
			{
				if (p0 == 2)
				{
					if (pos == pos0)
					{
						out = "A";
					}
					else if (pos > pos0)
					{
						out = "E";
					}
					else
					{
						out = "G";
					}
				}
				else if (p0 == 1)
				{
					if (pos < pos0)
					{
						out = "D";
					}
					else if (pos == pos0)
					{
						out = "F";
					}
				}
			}
			else if (p == 1)
			{
				if (p0 == 1)
				{
					out = "B";
				}
			}
		}

		p0 = p;
		pos0 = pos;

		i++;
		if (i == 8)
		{
			i = 0;
			cout << out << endl;
			out = "";
			p0 = -1;
			pos0 = -1;
		}
	}

}
