Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"reflect"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func scanBoard() [][]int {
	ret := make([][]int, 8)
	for k := range ret {
		ret[k] = make([]int, 8)
		for l := range ret[k] {
			ret[k][l] = 0
		}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		row := strings.Split(scanner.Text(), "")
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			break
		}
		fmt.Println(board)
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 {
					ans = "A"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+2][j] == 1 && board[i+3][j] == 1 {
					ans = "B"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i][j+2] == 1 && board[i][j+3] == 1 {
					ans = "C"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j+1] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j] == 1 {
					ans = "D"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 && board[i+1][j+2] == 1 {
					ans = "E"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j+1] == 1 && board[i][j+2] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 {
					ans = "G"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j+1] == 1 {
					ans = "F"
				}
			}
		}
		fmt.Println(ans)
	}
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    while (1)
    {
        string d[8];
        rep(i, 8)
        {
            cin >> d[i];
            if (cin.eof())
                return 0;
        }

        int st_x, st_y, ed_x, ed_y;
        rep(i, 8)
        {
            int flag = 0;
            rep(j, 8)
            {
                if (d[i][j] == '1')
                {
                    st_x = j, st_y = i;
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
                break;
        }
        rep(i, 8)
        {
            rep(j, 8)
            {
                if (d[i][j] == '1')
                {
                    ed_x = j, ed_y = i;
                }
            }
        }

        int dis_x = ed_x - st_x, dis_y = ed_y - st_y;

        if (dis_y == 0)
        {
            OP("C")
        }
        else if (dis_y == 1)
        {

            if (dis_x == 0)
                OP("G")
            if (dis_x == 1)
                OP("A")
            if (dis_x == 2)
                OP("E")
        }
        else if (dis_y == 2)
        {
            if (dis_x == -1)
                OP("D")
            if (dis_x == 1)
                OP("F")
        }
        else if (dis_y == 3)
        {
            OP("B")
        }
    }

    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main(){
 
  string s[10];
 
  while(cin >> s[0]){
    for(int i=1;i<8;i++) cin >> s[i];
 
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
 
    if(s[i][j] == '1'){
      if(s[i][j+1] == '1' && s[i+1][j] == '1' && s[i+1][j+1] == '1') cout << 'A' << endl;
      else if(s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1') cout << 'B' << endl;
      else if(s[i][j+1] == '1' && s[i][j+3] == '1' && s[i][j+3] == '1') cout << 'C' << endl;
      else if(s[i+1][j-1] == '1' && s[i+1][j] == '1' && s[i+2][j-1] == '1') cout << 'D' << endl;
      else if(s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1') cout << 'E' << endl;
      else if(s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1') cout << 'F' << endl;
      else if(s[i][j+1] == '1' && s[i+1][j-1] == '1' && s[i+1][j] == '1') cout << 'G' << endl;
    }
 
      }
    }
  }
}

C++: #include <cstdio>
using namespace std;

int pos[7][4] = {{0, 1, 10, 11}, {0, 10, 20, 30}, {0, 1, 2, 3},
{1, 10, 11, 20}, {0, 1, 11, 12}, {0, 10, 11, 21}, {1, 2, 10, 11}};
char s[110] = {0};

int main()
{
	int i, j, k;
	
	while( scanf("%s", s + 1) != -1 ){
		for( i = 1; i < 8; i++ )
			scanf("%s", s + 10 * i + 1);
		
		for( i = 0; i < 7; i++ ){
			for( j = 0; j < 100; j++ ){
				for( k = 0; k < 4; k++ ){
					if( pos[i][k] + j >= 110 || s[pos[i][k] + j] != '1' )
						break;
				}
				if( k == 4 )	//??????????????´????????¨??¨'1'?????£?????´???????????????
					break;
			}
			if( j < 100 )	//?????§???????????´???????????????
				break;
		}
		printf("%c\n", 'A' + i );
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

char m[8][8];
void figure(int, int);

int main() {

	while(1) {
		bool f = true;
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				cin >> m[i][j];
			}
		}
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				if(m[i][j] == '1') {
					figure(i, j);
					f = false;
					break;
				}
			}
			if(!f) {
				break;
			}
		}
	}
}


void figure(int i, int j) {
	char s;
	if(m[i][j+1] == '1' && m[i+1][j+1]== '1' && m[i+1][j]== '1') {
		s = 'A';
	}
	else if(m[i+1][j] == '1' && m[i+2][j] == '1') {
		s = 'B';
	}
	else if(m[i][j+1] == '1' && m[i][j+2] == '1') {
		s = 'C';
	}
	else if(m[i][j+1] == '1' && m[i+1][j+1] == '1') {
		s = 'E';
	}
	else if(m[i][j+1] == '1') {
		s = 'G';
	}
	else if(m[i+1][j+1] == '1') {
		s = 'F';
	}
	else {
		s = 'D';
	}
	cout << s << endl;
}

C++: #include <cstdio>
#include <utility>
#include <vector>
#include <string>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
is(string &s){int c; s = "";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

typedef vector<string> v;

char pat_search(v &a) {
	static auto p = [&a](int i, int j) {
		return i >= 0 && i < 8 && j >= 0 && j < 8 && a[i][j] == '1';};
	for (int i = 0; i < 8; i++)
		for (int j = 0; j < 8; j++)
			if (a[i][j] == '1') {
				return p(i + 1, j + 1) ? p(i, j + 1) ? p(i + 1, j + 2) ? 'E' : 'A' : 'F' :
					p(i, j + 1) ? p(i, j + 2) ? 'C' : 'D' :
					p(i + 2, j) ? 'B' : 'G';
			}
	return 'X';
}

int main() {
	v a(8);
	do {
		for (auto &s: a)
			scan(s);
		out(pat_search(a), '\n');
	} while (gcu() == '\n');
}