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 <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    char tiya[8][8];
    while(true){
    if(cin.eof())break;
        cin>>tiya[0][0];
        if(tiya[0][0]=='\0')cin>>tiya[0][0];
    vector<pii>gotiusa;
    rep(i,8)rep(j,8){
        if(i==0&&j==0)continue;
        cin>>tiya[i][j];
        if(tiya[i][j]=='1')gotiusa.push_back(pii(7-i,j));
    }
    int tate=0;
    int yoko=0;
    pii t=pii(-INF,INF),y=pii(-INF,INF);
    rep(i,gotiusa.size()){
        cmax(t.first,gotiusa[i].first);
        cmin(t.second,gotiusa[i].first);
        cmax(y.first,gotiusa[i].second);
        cmin(y.second,gotiusa[i].second);
    }
    tate=t.first-t.second;
    yoko=y.first-y.second;
    if(tate==3) puts("B");
    else if(yoko==3) puts("C");
    else if(yoko==1&&tate==1)puts("A");
    else if(tate==2&&yoko==1){
        int a = 0,b = 0;
        rep(i,gotiusa.size()){
            if(t.first==gotiusa[i].first)a=gotiusa[i].second;
            else if(t.second==gotiusa[i].first)b=gotiusa[i].second;
        }
            (a>b ? puts("D"):puts("F"));
    }
    else if(tate==1&&yoko==2){
        int a = 0,b = 0;
        rep(i,gotiusa.size()){
            if(y.first==gotiusa[i].second)a=gotiusa[i].first;
            else if(y.second==gotiusa[i].second)b=gotiusa[i].first;
        }
         (a>b ? puts("G"):puts("E"));
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){

	while(1){
		int data[7]={22,60,6,38,24,42,20},a=0,b=0,sum=0;
		char x;
		rer(i,1,8){
			rer(j,1,8){
				if(!(cin>>x)) return 0;
				//if(cin.eof()) return 0;//!!!!!!!
				if(x=='1'){
					if(a==0 && b==0){
						a=i; b=j;
					}else{
						sum+=10*(i-a)+j-b;
					}
				}
				//o(sum);
			}
		}
		rep(i,0,7){
			if(sum==data[i]){
				char c;
				c='A'+i;
				o(c); break;
			}
		}
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

int main() {
	VS s(10);
	while (cin >> s[0]) {
		s[0] += "00000";
		FOR(i, 1, 8) { cin >> s[i]; s[i] += "00000"; }
		s[8] = string(15, '0');
		s[9] = string(15, '0');

		int x = -1, y = -1;
		rep(i, 8)rep(j, 8) {
			if (x == -1 && y == -1 && s[i][j] == '1') { x = j; y = i; break; }
		}

		bool f2 = s[y + 1][x] == '1';
		bool f1 = s[y][x + 1] == '1';
		bool f3 = s[y + 1][x + 1] == '1';

		char ans = '#';
		if (f1 && f2) {//A G
			ans = f3 ? 'A' : 'G';
		}
		else if (f1 && !f2) {//C E
			ans = f3 ? 'E' : 'C';
		}
		else if (!f1 && f2) {//B D F
			if (f3)ans = 'F';
			else ans = s[x][y + 2] == '1' ? 'B' : 'D';
		}
		Cout(ans);
	}
}

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