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>
#include<cstring>

using namespace std;
#define W 8
#define H 8
#define W_C 12
#define H_C 12

char tile[W_C][H_C];

char check(int w,int h)
{

    if(tile[w][h+1]=='1'&&tile[w-1][h+1]=='1'&&tile[w-1][h+2]=='1') return 'D';
    if(tile[w+1][h]=='1'&&tile[w][h+1]=='1'&&tile[w+1][h+1]=='1') return 'A';
    if(tile[w][h+1]=='1'&&tile[w][h+2]=='1'&&tile[w][h+3]=='1') return 'B';
    if(tile[w+1][h]=='1'&&tile[w+2][h]=='1'&&tile[w+3][h]=='1') return 'C';
    if(tile[w+1][h]=='1'&&tile[w+1][h+1]=='1'&&tile[w+2][h+1]=='1') return 'E';
    if(tile[w][h+1]=='1'&&tile[w+1][h+1]=='1'&&tile[w+1][h+2]=='1') return 'F';
    if(tile[w+1][h]=='1'&&tile[w-1][h+1]=='1'&&tile[w][h+1]=='1') return 'G';

    return 'Y';
}


int main()
{
    while(1)
    {
        memset(tile,'0',sizeof(tile));
        char ans = 'Z';

        for(int j=1;j<=H;j++)
        {
            for(int i=1;i<=W;i++)
            {
                cin >> tile[i][j];

            }
        }
        for(int j=1;j<=H;j++)
        {
            for(int i=1;i<=W;i++)
            {
                if(tile[i][j]=='1')
                {
                    ans = check(i,j);
                    break;
                }
            }
            if(ans != 'Z') break;
        }



        if(cin.eof()) break;
        cout << ans << endl;
    }
    return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	char ans = '0', wk;
	int F[16][16];
	while(cin >> wk)
	{
		memset(F, 0, sizeof(F));
		F[0][0] = wk - '0';
		ans = '0';


		for(int i = 0; i < 8; i++)
		{
			for(int j = 0; j < 8; j++)
			{
				if(i == 0 && j == 0)
					continue;
				cin >> wk;
				F[i][j] = wk - '0';
			}
		}

		for(int i = 0; i < 8; i++)
		{
			for(int j = 0; j < 8; j++)
			{
				if(F[i][j] && F[i][j+1] && F[i+1][j] && F[i+1][j+1])
				{
					ans = 'A';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+2][j] && F[i+3][j])
				{
					ans = 'B';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i][j+2] && F[i][j+3])
				{
					ans = 'C';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+1][j-1] && F[i+2][j-1])
				{
					ans = 'D';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i+1][j+1] && F[i+1][j+2])
				{
					ans = 'E';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+1][j+1] && F[i+2][j+1])
				{
					ans = 'F';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i-1][j+1] && F[i-1][j+2])
				{
					ans = 'G';
					break;
				}
			}
			if(ans != '0')
			{
				break;
			}
		}

		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string mass[8];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i-1][j] == '1' && mass[i-1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;

        for (int i = 0; i < 8; i++) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

const double EPS = 1.0e-6;

int main()
{
	while(1){
		string all[8];
		bool endflg = false;
		for(int i=0; i<8; i++){
			if(!(cin>>all[i])) endflg = true;
			if(endflg) break;
		}
		if(endflg) break;

		for(int i=0; i<7; i++){
			bool breakflg = false;
			for(int j=0; j<7; j++){
				// ツ可。ツづ可個ゥツづゥ
				if(all[i][j]-'0'==1&&all[i][j+1]-'0'==1){
					if(all[i+1][j]-'0'==1&&all[i+1][j+1]-'0'==1){
						ans = "A";
					} else if(all[i+1][j]-'0'==0&&all[i+1][j+1]-'0'==0){
						ans = "C";
					} else if(all[i+1][j]-'0'==1&&all[i+1][j+1]-'0'==0){
						ans = "G";
					} else if(all[i+1][j]-'0'==0&&all[i+1][j+1]-'0'==1){
						ans = "E";
					}
					breakflg = true;
					break;
				}
				// ツ縦ツづ可個ゥツづゥ
				if(all[i][j]-'0'==1&&all[i+1][j]-'0'==1){
					if(all[i][j+1]-'0'==1&&all[i+1][j+1]-'0'==1){
						ans = "A";
					} else if(all[i][j+1]-'0'==0&&all[i+1][j+1]-'0'==0){
						ans = "B";
					} else if(all[i][j+1]-'0'==1&&all[i+1][j+1]-'0'==0){
						ans = "D";
					} else if(all[i][j+1]-'0'==0&&all[i+1][j+1]-'0'==1){
						ans = "F";
					}
					breakflg = true;
					break;
				}
			}
			if(breakflg) break;
		}
		cout<<ans<<endl;
	}
	return 0;
}