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;
char str[9][9];
int mx[4]={1,0,-1,0},my[4]={0,1,0,-1},moving[4];
void serch(int mo,int y,int x)
{
    for(int i=0;i<4;i++){
            if(str[my[i]+y][x+mx[i]]=='1'&&my[i]+y>=0&&my[i]+y<9&&mx[i]+x>=0&&mx[i]+x<9){
                str[my[i]+y][x+mx[i]]='0';
                moving[mo]=i;
                serch(mo+1,y+my[i],x+mx[i]);
            }

    }
}
int main()
{
    int co=0;
    while(cin>>str[0]){
        for(int i=1;i<8;i++)cin>>str[i];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(str[i][j]=='1'&&co==0){
                    str[i][j]='0';
                    serch(0,i,j);
                    co=1;
                    break;
                }
                else if(str[i][j]=='1'&&co==1)co++;
            }
        }
        if(moving[0]==0&&co!=2){
            if(moving[1]==1){
                if(moving[2]==2)cout<<"A"<<endl;
                else cout<<"E"<<endl;
            }
            else cout<<"C"<<endl;
        }
        else if(moving[0]==3&&co!=2){
            if(moving[1]==0)cout<<"F"<<endl;
            else if(moving[1]==3)cout<<"B"<<endl;
            else cout<<"D"<<endl;
        }
        else cout<<"G"<<endl;
        co=0;
    }
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    enum blocks{
        A = 18, B = 48, C = 6, D = 30, E = 20, F = 34, G = 16
    };
    string surface, input;
    while(cin >> input){
        surface = input;
        rep(i,7){
            cin >> input;
            surface+= input;
        }
        int first = 0, location = 0;
        rep(i,65){
            if(surface[i] == '1' && first == 0){
                first = i;
            }else if(surface[i] == '1'){
                location+= i - first;
            }
        }
        if(A == location) cout << 'A' << endl;
        else if(B == location) cout << 'B' << endl;
        else if(C == location) cout << 'C' << endl;
        else if(D == location) cout << 'D' << endl;
        else if(E == location) cout << 'E' << endl;
        else if(F == location) cout << 'F' << endl;
        else if(G == location) cout << 'G' << endl;
    }
}

C++: #include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	char t, c;
	vector<vector<char> > v(8, vector<char>(8, 0));

	while (cin >> c) {
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (i == 0 && j == 0) {
					v.at(0).at(0) = c;
				}
				else {
					cin >> c;
					v.at(i).at(j) = c;
				}
				/*
				cout << v.at(i).at(j);
				if (j == 7) cout << endl;
				if (i == 7 && j == 7) cout << endl;
				*/
			}
		}

		int f = 0;
		int cnt = 0;
		typedef struct point {
			int f, s;
		} Ps;
		Ps a, b;

		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				char ch = v.at(i).at(j);
				if (ch == '1') cnt++;

				if (ch == '1' && cnt == 1) {
					a.f = i;
					a.s = j;
				}
				else if (ch == '1' && cnt == 4) {
					b.f = i;
					b.s = j;
				}

				if (cnt == 4) break;
			}

			if (cnt == 4) break;
		}
		//cout << a.f << ' ' << a.s << endl;
		//cout << b.f << ' ' << b.s << endl;

		if (a.f + 1 == b.f) {
			if (a.s + 1 == b.s) t = 'A';
			if (a.s == b.s) t = 'G';
			if (a.s + 2 == b.s) t = 'E';
		}
		else if (a.f + 2 == b.f) {
			if (a.s - 1 == b.s) t = 'D';
			if (a.s + 1 == b.s) t = 'F';
		}
		else if (a.f == b.f) {
			t = 'C';
		}
		else if (a.f + 3 == b.f) {
			t = 'B';
		}

		cout << t << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	char p[8][9];
	int i,j;
	while(cin>>p[0]>>p[1]>>p[2]>>p[3]>>p[4]>>p[5]>>p[6]>>p[7]){
		for(i=0; i<8 ; ++i){
			for(j=0 ;j < 9 ; ++j){
				if(p[i][j]=='1') goto next; 
			}
		}
		next:
		if (p[i][j+1]=='1' &&p[i+1][j]=='1' && p[i+1][j+1]=='1') cout << 'A' << endl;
		else if (p[i+1][j]=='1' && p[i+2][j]=='1' && p[i+3][j]=='1') cout << 'B' << endl;
		else if (p[i][j+1]=='1' && p[i][j+2]=='1' && p[i][j+3]=='1') cout << 'C' << endl;
		else if (p[i+1][j]=='1' && p[i+1][j-1]=='1' && p[i+2][j-1]=='1' ) cout << 'D' << endl;
		else if (p[i][j+1]=='1' && p[i+1][j+1]=='1' && p[i+1][j+2]=='1' ) cout << 'E' << endl;
		else if (p[i+1][j]=='1' && p[i+1][j+1]=='1' && p[i+2][j+1]=='1' ) cout << 'F' << endl;
		else if (p[i][j+1]=='1' && p[i+1][j]=='1' && p[i+1][j-1]=='1' ) cout << 'G' << endl;
	}
	return 0; 
}