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(), "")
		if reflect.DeepEqual(row, []string{}) {
			break
		}
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			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 <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;
}

C++: #include <iostream>
#include <string>
#include <vector>

using namespace std;

bool one(const vector<string> &v, int x, int y) {
    if(x < 0 || y < 0 || x >= v[0].size() || y >= v.size()) return false;
    return v[y][x] == '1';
}

int main() {
    vector<string> v(8);
    while(cin >> v[0]) {
        for(int i = 1; i < 8; ++i) cin >> v[i];

        char kind;
        for(int y = 0; y < 8; ++y) {
            for(int x = 0; x < 8; ++x) {
                if(one(v, x, y)) {
                    if(one(v, x+1, y) && one(v, x, y+1) && one(v, x+1, y+1)) kind = 'A';
                    else if(one(v, x, y+1) && one(v, x, y+2) && one(v, x, y+3)) kind = 'B';
                    else if(one(v, x+1, y) && one(v, x+2, y) && one(v, x+3, y)) kind = 'C';
                    else if(one(v, x, y+1) && one(v, x-1, y+1) && one(v, x-1, y+2)) kind = 'D';
                    else if(one(v, x+1, y) && one(v, x+1, y+1) && one(v, x+2, y+1)) kind = 'E';
                    else if(one(v, x, y+1) && one(v, x+1, y+1) && one(v, x+2, y+2)) kind = 'F';
                    else if(one(v, x+1, y) && one(v, x, y+1) && one(v, x-1, y+1)) kind = 'G';
                    goto end;
                }
            }
        }
end:
        cout << kind << endl;
    }
    return 0;
}