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 < 7; i++ {
			for j := 0; j < 7; 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 < 5; 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 < 5; 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 < 6; i++ {
			for j := 0; j < 7; 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 < 7; i++ {
			for j := 0; j < 6; 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 < 7; i++ {
			for j := 0; j < 6; 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 < 6; i++ {
			for j := 0; j < 7; 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++: #include <iostream>
#include <string>
using namespace std;

#define SIZE 8

int main() {
	string source[SIZE];
	while (!cin.eof()) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		bool map[14][14] = {false};
		int x = SIZE - 1, y = SIZE - 1;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = (source[i][j] == '1' ? true : false);
				if (source[i][j] == '1' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "A";
		} 
		if (map[y + 1][x + 1] && map[y + 2][x + 1] && map[y + 1][x]) {
			cout << "F";
		}
		if (map[y + 1][x + 1] && map[y + 1][x + 2] && map[y][x + 1]) {
			cout << "E";
		}
		if (map[y - 1][x - 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "G";
		}
		if (map[y - 1][x - 1] && map[y + 2][x - 1] && map[y + 1][x]) {
			cout << "D";
		}
		if (map[y + 1][x] && map[y + 2][x] && map[y + 3][x]) {
			cout << "B";
		}
		if (map[y][x + 1] && map[y][x + 2] && map[y][x + 3]) {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define int long long
vector<vector<int>> map(8,vector<int>(8,0));
bool ch(int y, int x){
	if (0<=x&&x<8&&0<=y&&y<8) return map[y][x]==1;
	else return false;
}
signed main(){
	char buf[256];
	int sx,sy;
	while( scanf("%s", buf) != EOF ){
		for(int j = 0; j < 8; j++){
			if(buf[j] == '1') map[0][j] = 1;
			else map[0][j] = 0;
		}
		for(int i = 1; i < 8; i++){
			scanf("%s", buf);
			for(int j = 0; j < 8; j++){
				if(buf[j] == '1') map[i][j] = 1;
				else map[i][j] = 0;
			}
		}
		int sx=-1,sy=-1;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(map[i][j]==1){
					sx = j;
					sy = i;
					goto next;
				}
			}
		}
next:
		if(ch(sy,sx+1)&&ch(sy+1,sx)&&ch(sy+1,sx+1)) printf("A\n");
		else if(ch(sy+1,sx)&&ch(sy+2,sx)&&ch(sy+3,sx)) printf("B\n");
		else if(ch(sy,sx+1)&&ch(sy,sx+2)&&ch(sy,sx+3)) printf("C\n");
		else if(ch(sy+1,sx)&&ch(sy+1,sx-1)&&ch(sy+2,sx-1)) printf("D\n");
		else if(ch(sy,sx+1)&&ch(sy+1,sx+1)&&ch(sy+1,sx+2)) printf("E\n");
		else if(ch(sy+1,sx)&&ch(sy+1,sx+1)&&ch(sy+2,sx+1)) printf("F\n");
		else if(ch(sy,sx+1)&&ch(sy+1,sx)&&ch(sy+1,sx-1)) printf("G\n");
		else printf("error\n");
	}
	return 0;
}

C++: #include<cstdio>
#define REP(i,a,n) for(int i  = a;i < n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int in(){int n;scanf("%d",&n); return n;}
int main(void){
 int atlas[10][10];
 rep(i,8){

 return 0;
}

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

char c[8][12];

int find(){
    int i = 0;
    while( c[i/8][i%8] == '0' ) i++;
    return i;
}

int main(){
    const char O = '1', Z = '0';
    char dummy[4];
    while( true ){
        int i = 0;
        while( i < 8 && scanf("%s", c[i]) != EOF ){
            i++;
        }
        if( i < 8 ) break;
        int p = find();
        if( c[p/8][p%8+1] == O && c[p/8+1][p%8] == O ){
            if( c[p/8+1][p%8+1] == O ) puts("A");
            else puts("G");
        }
        else if( c[p/8+2][p%8] == O ) puts("B");
        else if( c[p/8][p%8+2] == O ) puts("C");
        else if( c[p/8+1][p%8] == O && c[p/8+2][p%8] == Z &&
            c[p/8][p%8+1] == Z ){
            if( c[p/8+1][p%8+1] == Z ) puts("D");
            else puts("F");
        }
        else if( c[p/8+1][p%8] == Z && c[p/8+1][p%8+1] == O ) puts("E");
        fgets(dummy, 4, stdin);
    }
    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	while (true) {
		char f[11][11];
		int x = -1, y = -1;
		REP(i, 8)REP(j, 8) {
			if (!(cin >> f[j][i]))return 0;
			if (f[j][i] == '1'&&x == -1) {
				x = j; y = i;
			}
		}
		string ans;
		if (f[x + 3][y] == '1') {
			ans = "C";
		}
		else if (f[x][y + 3] == '1') {
			ans = "B";
		}
		else if (f[x + 1][y] == '1') {
			//AEG
			if (f[x][y + 1] == '0') ans = "E";
			else if (f[x + 1][y + 1] == '1') ans = "A";
			else ans = "G";
		}
		else {
			//DF
			if (f[x + 1][y + 1] == '1') ans = "F";
			else ans = "D";
		}
		cout << ans << endl;
	}
	return 0;
}