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 ca {
	int x;
	int y;
};

int main() {
	ca l[4];
	char c;
	while (!cin == EOF) {
		int a = 0;
		for (int i = 0; i < 8; i++) {
			for (int j = 1; j < 8; j++) {
				cin >> c;
				if (c == '1')
				{
					l[a].x = i;
					l[a].y = j;
					a++;
				}
			}
		}
		int x = l[0].x;
		int y = l[0].y;
		if (l[1].x == x&&l[1].y == y + 1) {
			//[l0][l1]
			//ACEG
			if (l[3].x == x + 1 && l[3].y == y + 1)
				cout << 'A';
			else if (l[3].y == y + 3)
				cout << 'C';
			else if (l[3].x == x + 1 && l[3].y == y + 2)
				cout << 'E';
			else cout << 'G';
		}
		else if (l[1].x == x + 1 && l[1].y == y) {
			/*[l0]
			  [l1]*/
			  //BF
			if (l[3].x == x + 3 && l[3].y == y)
				cout << 'B';
			else cout << 'F';
		}
		else cout << 'D';
		cout << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

char map[8][9];

char solve() {
	for (int i=0; i<8; ++i) {
		for (int j=0; j<8; ++j) {
			if (map[i][j] == '1') {
				if (i<7 && j<7 && map[i][j+1]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1') return 'A';
				if (i<5 && map[i+1][j]=='1' && map[i+2][j]=='1' && map[i+3][j]=='1') return 'B';
				if (j<5 && map[i][j+1]=='1' && map[i][j+2]=='1' && map[i][j+3]=='1') return 'C';
				if (i<6 && j>0 && map[i+1][j]=='1' && map[i+1][j-1]=='1' && map[i+2][j-1]=='1') return 'D';
				if (i<7 && j<6 && map[i][j+1]=='1' && map[i+1][j+1]=='1' && map[i+1][j+2]=='1') return 'E';
				if (i<6 && j<7 && map[i+1][j]=='1' && map[i+1][j+1]=='1' && map[i+2][j+1]=='1') return 'F';
				if (i<7 && j<7 && j>0 && map[i][j+1]=='1' && map[i+1][j]=='1' && map[i+1][j-1]=='1') return 'G';
			}
		}
	}
}

int main() {
	while (scanf("%s", map[0]) != EOF) {
		for (int i=1; i<8; ++i) scanf ("%s", map[i]);
		char ans = solve();
		printf ("%c\n", ans);
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int x[13][13]; char a;
int main() {
	while (cin >> a) {
		memset(x, 0, sizeof(x));
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				if (i + j > 2) {
					cin >> a; if (a == '0') { x[i][j] = 0; }
					else { x[i][j] = 1; }
				}
			}
		}
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				if (x[i][j] == 1) {
					if (x[i + 1][j] == 1 && x[i][j + 1] == 1 && x[i + 1][j + 1] == 1) {
						cout << 'A' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 2][j] == 1 && x[i + 3][j] == 1) {
						cout << 'B' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i][j + 2] == 1 && x[i][j + 3] == 1) {
						cout << 'C' << endl; goto Exit;
					}
					if (x[i + 1][j - 1] == 1 && x[i + 1][j] == 1 && x[i + 2][j - 1] == 1) {
						cout << 'D' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j + 1] == 1 && x[i + 1][j + 2] == 1) {
						cout << 'E' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 1][j + 1] == 1 && x[i + 2][j + 1] == 1) {
						cout << 'F' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j - 1] == 1 && x[i + 1][j] == 1) {
						cout << 'G' << endl; goto Exit;
					}
				}
			}
		}
	Exit:;
	}
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int main(){
	string s[7][4]={
		{
			"1100",
			"1100",
			"0000",
			"0000"
		},{
			"1000",
			"1000",
			"1000",
			"1000"
		},{
			"1111",
			"0000",
			"0000",
			"0000"
		},{
			"0100",
			"1100",
			"1000",
			"0000"
		},{
			"1100",
			"0110",
			"0000",
			"0000"
		},{
			"1000",
			"1100",
			"0100",
			"0000"
		},{
			"0110",
			"1100",
			"0000",
			"0000"
		}
	};
	
	const int N = 8;
	const int M = 4;
	string m[N];
	while(cin>>m[0]){
		reps(i,1,N)cin>>m[i];
		
		rep(i,N){
			rep(j,N){
				
				rep(c,7){
					bool ok = true;
					rep(k,M){
						rep(p,M){
							int x = j+p;
							int y = i+k;
							if(x>=N || y>=N){
								if(s[c][k][p]=='1')ok=false;
							}else{
								if(s[c][k][p]!=m[y][x])ok=false;
							}
						}
					}
					if(ok){
						printf("%c\n",'A'+c);
						goto A;
					}
				}
			}
		}
		A:;
	}
	
}

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

char mp[8][8];

void ans(char mp[8][8]){
    for(int i = 0 ; i < 8 ; i++){
        for(int j = 0 ; j < 8 ; j++){
            if(mp[i][j]=='1'){
                if(mp[i][j+1]=='1'&&mp[i+1][j]=='1'){
                    cout << 'A' << endl;
                    return;
                }
                else if(mp[i+3][j]=='1'){
                    cout << 'B' << endl;
                    return;
                }
                else if(mp[i][j+3]=='1'){
                    cout << 'C' << endl;
                    return;
                }
                else if(mp[i+2][j-1]=='1'){
                    cout << 'D' << endl;
                    return;
                }
                else if(mp[i+1][j+2]=='1'){
                    cout << 'E' << endl;
                    return;
                }
                else if(mp[i+2][j+1]=='1'){
                    cout << 'F' << endl;
                    return;
                }
                else{
                    cout << 'G' << endl;
                    return;
                }
            }
        }
    }
}

int main(){
    while(cin >> mp[0][0]){
        for(int i = 0 ; i < 8 ; i++){
            for(int j = 0 ; j < 8 ; j++){
                if(!i&&!j) continue;
                else cin >> mp[i][j];
            }
        }
        ans(mp);
    }
    
    return 0;
}