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>

using namespace std;

struct pt{
    int x, y;
};

int main()
{
    const pt figure[][3] = {{{ 1, 0}, { 0, 1}, { 1, 1}},
                            {{ 0, 1}, { 0, 2}, { 0, 3}},
                            {{ 1, 0}, { 2, 0}, { 3, 0}},
                            {{-1, 1}, { 0, 1}, {-1, 2}},
                            {{ 1, 0}, { 1, 1}, { 2, 1}},
                            {{ 0, 1}, { 1, 1}, { 1, 2}},
                            {{ 1, 0}, {-1, 1}, { 0, 1}},
    };
    char s[8][10];
    do{
        int i=0;
        for(i=0; i<8; i++) cin.getline(s[i], 10);
        int x=0, y=0;
        for(y=0; y<8; y++){
            for(x=0; x<8; x++){
                if(s[y][x]=='1') goto found;
            }
        }
        found:
        
        for(i=0; i<7; i++){
            bool match=true;
            for(int j=0; j<3; j++){
                int tx=x+figure[i][j].x;
                int ty=y+figure[i][j].y;
                if(tx<0||7<tx||ty<0||7<ty){
                    match=false;
                    break;
                }
                if(s[ty][tx]=='0'){
                    match=false;
                    break;
                }
            }
            if(match) break;
        }
        cout<<(char)('A'+i)<<'\n';
    }while(cin.getline(s[0], 10));
    return 0;
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	char table[8][9];

	while(scanf("%s",table[0])!=EOF){
		for(int i=1;i<8;i++){
			scanf("%s",table[i]);
		}
		getchar();
		bool FLG = false;
		for(int i=0; i < 8; i++){
			for(int k=0; k<8; k++){
				if(table[i][k] == '1'){
					if(i <= 6 && k <= 6 && table[i][k+1] == '1' && table[i+1][k] == '1' && table[i+1][k+1] == '1'){
						printf("A\n");
						FLG = true;
						//break;
					}else if(i <= 4 && table[i+1][k] == '1' && table[i+2][k] == '1' && table[i+3][k] == '1'){
						printf("B\n");
						FLG = true;
						//break;
					}else if(k <= 4 && table[i][k+1] == '1' && table[i][k+2] == '1' && table[i][k+3] == '1'){
						printf("C\n");
						FLG = true;
						//break;
					}else if(i <= 5 && k >= 1 && table[i+1][k-1] == '1' && table[i+1][k] == '1' &&
							table[i+2][k-1] == '1'){
						printf("D\n");
						FLG = true;
						//break;
					}else if(i <= 6 && k <= 5 && table[i][k+1] == '1' && table[i+1][k+1] == '1' &&
							table[i+1][k+2] == '1'){
						printf("E\n");
						FLG = true;
						//break;
					}else if(i <= 5 && k <= 6 && table[i+1][k] == '1' && table[i+1][k+1] == '1' &&
							table[i+2][k+1] == '1'){
						printf("F\n");
						FLG = true;
						//break;
					}else if(i <= 6 && k <= 6 && k >= 1 && table[i][k+1] == '1' && table[i+1][k-1] == '1' &&
							table[i+i][k] == '1'){
						printf("F\n");
						FLG = true;
						//break;
					}
				}
				if(FLG)break;
			}
			if(FLG)break;
		}

	}


	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	bool br = false;
	while (true){
		bool cell[8][8] = { false };
		int ans = 0;
		REP(i, 8){
			string s;
			getline(cin, s);
			if (s.empty){
				br = true;
				break;
			}
			REP(j, 8){
				if (s[j] == '1')
					cell[i][j] = true;
			}
		}
		if (br)
			break;
		REP(i, 8){
			REP(j, 8){
				if (cell[i][j]){
					REP(k, 3)
						REP(l, 3)
						if (i + (k - 1) >= 0 && i + (k - 1) < 8 && j + (l - 1) >= 0 && j + (l - 1) < 8 && cell[i + (k - 1)][j + (l - 1)])
							ans += 1 << (8 - (k * 3 + l));
					i = 8;
					j = 8;
				}
			}
		}
		switch (ans){
		case 27:
			cout << 'A' << endl;
			break;
		case 18:
			cout << 'B' << endl;
			break;
		case 24:
			cout << 'C' << endl;
			break;
		case 22:
			cout << 'D' << endl;
			break;
		case 25:
			cout << 'E' << endl;
			break;
		case 19:
			cout << 'F' << endl;
			break;
		case 30:
			cout << 'G' << endl;
			break;
		}
	}
}

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