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++: #include <bits/stdc++.h>  

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

char s[10][10];

int main() {
	while(cin >> s[0]) {
		FOR(i, 1, 8) cin >> s[i];
		rep(i, 8) rep(j, 8) if(s[i][j] == '1') {
			if(s[i][j+1] == '1') {
				if(s[i+1][j] == '1' && s[i+1][j+1] == '1') {
					printf("A\n");
					return 0;
				}
				else if(s[i+1][j+1] == '1' && s[i+1][j+2] == '1') {
					printf("E\n");
					return 0;
				}
				else if(s[i][j+2] == '1' && s[i][j+3] == '1') {
					printf("C\n");
					return 0;
				}
				else {
					printf("G\n");
					return 0;
				}
			}
			else {
				if(s[i-1][j-1] == '1' && s[i+1][j] == '1' && s[i+2][j-1] == '1') {
					printf("D\n");
					return 0;
				} 
				else if(s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1') {
					printf("F\n");
					return 0;
				}
				else {
					printf("B\n");
					return 0;
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
bool deb(int x){cout<<x<<":ok"<<endl;return true;}
bool deb(){cout<<"ok"<<endl;return true;}
int main() {
	bool a[20][20]={};
	char e;
	while(cin>>e)
	{
		if(e=='1')a[0][0]=true;
				else a[0][0]=false;
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				
				if(x==0&&y==0)continue;
				cin>>e;
				if(e=='1')a[y][x]=true;
				else a[y][x]=false;

			}
		}
		
		bool end=false;
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(a[x][y]&&a[x+1][y]&&a[x][y+1]&&a[x+1][y+1])
				{
					cout<<"A"<<endl;
					end=true;
				}
				if(a[x][y]&&a[x][y+1]&&a[x][y+2]&&a[x][y+3])
				{
					cout<<"B"<<endl;
					end=true;
				}
				if(a[x][y]&&a[x+1][y]&&a[x+2][y]&&a[x+3][y])
				{
					cout<<"C"<<endl;
					end=true;
				}
				if(a[x+1][y]&&a[x][y+1]&&a[x+1][y+1]&&a[x][y+2])
				{
					cout<<"D"<<endl;
					end=true;
				}
				if(a[x][y]&&a[x+1][y]&&a[x+1][y+1]&&a[x+2][y+1])
				{
					cout<<"E"<<endl;
					end=true;
				}
				if(a[x][y]&&a[x][y+1]&&a[x+1][y+1]&&a[x+1][y+2])
				{
					cout<<"F"<<endl;
					end=true;
				}
				if(a[x+1][y]&&a[x+2][y]&&a[x][y+1]&&a[x+1][y+1])
				{
					cout<<"G"<<endl;
					end=true;
				}

				if(end)break;
			}
			if(end)break;
		}


	}
}

C++: #include<iostream>
using namespace std;
int main() {
	char c[10][10];
    while (cin>>c[0][0]){
        for (int i = 0; i < 8; i++)
            for (int j = 0; j < 8; j++)
                if(i==0&&j==0)continue;
                cin >> c[i][j];
        int a, b;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (c[i][j] == '1') {
                    a = i;
                    b = j;
                    goto C;
                }
            }
        }
    C:
        if (c[a][b + 1] == '1') {
            if (c[a + 1][b] == '1') {
                if (c[a + 1][b + 1] == '1')
                    cout << 'A';
                else cout << 'G';
            }
            else {
                if (c[a + 1][b + 1] == '1')
                    cout << 'E';
                else cout << 'C';
            }
        }
        else if (c[a + 1][b + 1] == '1')
            cout << 'F';
        else if (c[a + 1][b - 1] == '1')
            cout << 'D';
        else cout << 'B';
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>

char data[8][8];
int px, py;

int main(){
	while (true){
		for(int i = 0; i < 8 ; i++){
			for(int j = 0; j < 8; j++){
				if(!(std::cin >> data[i][j]))break;
				if(data[i][j] == '1')px = j, py = i;
			}
		}

		if (data[py][px - 1] == '1' && data[py - 1][px] == '1' && data[py - 1][px - 1] == '1')printf("A\n");
		else if (data[py - 1][px] == '1' && data[py - 2][px] == '1' && data[py - 3][px] == '1')printf("B\n");
		else if (data[py][px - 1] == '1' && data[py][px - 2] == '1' && data[py][px - 3] == '1')printf("C\n");
		else if (data[py][px - 1] == '1' && data[py + 1][px - 1] == '1' && data[py - 1][px] == '1')printf("D\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py - 1][px - 2] == '1')printf("E\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py + 1][px] == '1')printf("F\n");
		else if (data[py - 1][px] == '1' && data[py - 1][px + 1] == '1' && data[py][px - 1] == '1')printf("G\n");
	}     
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int dx[7][4]={{0,0,1,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,-1,0,1}};
int dy[7][4]={{0,1,1,0},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,1,1,0}};
string MAP[8];
string ans="ABCDEFG";

int main(){
	while(1){
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			cin >> MAP[i][j];
		}
	}
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			if(MAP[i][j]=='1'){
				for(int k=0; k<7; ++k){
					bool ok=true;
					for(int l=0; l<4; ++l){
						int nx=j+dx[k][l];
						int ny=i+dy[k][l];
						if((0<=nx&&nx<8&&0<=ny&&ny<8&&MAP[ny][nx]!='1')||(nx<0||8<=nx||ny<0||8<=ny)){
							ok=false;
							break;
						}
					}
					if(ok){
						cout << ans[k] << "\n";
						break;
					}
				}
			}
		}
	}
	}
	return 0;
}