using System;
using System.Text;
using System.Collections.Generic;

namespace test
{

    class Program
    {

        struct One
        {
            public int Count;
            public int Index;
        }

        static void Main(string[] args)
        {
            List<string> resultList = new List<string>();
            List<string> inputList = new List<string>();

            bool firstFlag = true;
            string input;
            while ((input = Console.ReadLine()) != null)
            {
                if (!firstFlag)
                {
                    for (int i = 0; i < 8; i++)
                    {
                        inputList.Add(Console.ReadLine());
                    }
                }
                else
                {
                    inputList.Add(input);
                    for (int j = 0; j < 7; j++)
                    {
                        inputList.Add(Console.ReadLine());
                    }
                    firstFlag = false;
                }

                resultList.Add(CheckFigure(inputList));
                inputList.Clear();

            }

            foreach (string s in resultList)
            {
                Console.WriteLine(s);
            }

        }

        static string CheckFigure(List<string> inputList)
        {
            for (int i = 0; i < 8; i++)
            {
                if (inputList[i] != "00000000")
                {
                    switch (CheckOne(inputList[i]).Count)
                    {
                        case 1:
                            return JudgeBDF(inputList,i);
                        case 2:
                            return JudgeAEG(inputList,i);
                        case 4:
                            return "C";
                    }


                }

            }
                return "";
        }

        static string JudgeBDF(List<string> inputList, int rowIndex)
        {
            if (CheckOne(inputList[rowIndex + 1]).Count == 1)
            {
                return "B";
            }
            else if (CheckOne(inputList[rowIndex]).Index == CheckOne(inputList[rowIndex + 1]).Index)
            {
                return "F";
            }
            else
            {
                return "D";
            }

        }

        static string JudgeAEG(List<string> inputList, int rowIndex)
        {
            if (CheckOne(inputList[rowIndex]).Index == CheckOne(inputList[rowIndex + 1]).Index)
            {
                return "A";
            }
            else if (CheckOne(inputList[rowIndex]).Index == CheckOne(inputList[rowIndex + 1]).Index - 1)
            {
                return "E";
            }
            else
            {
                return "G";
            }
        }

        static One CheckOne(string s)
        {
            One tmpOne = new One();

            bool first = true;
            for (int i = 0; i < 8; i++)
            {
                if (s[i] == '1')
                {
                    if(first)
                    {
                        tmpOne.Index = i;
                        first = false;
                    }
                    tmpOne.Count++;
                }
            }

            return tmpOne;
        }

    }
}

Measured memory_bytes: 5400