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 <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e-8;
//typedef vector<int> vec;
typedef vector<char> vec;
typedef vector<vec> mat;
typedef pair<int,int> P;
struct edge{int to,cost;};


const int block[8][7][4] ={
    {{1,1,0,0},
     {1,1,0,0},
     {0,0,0,0},
     {0,0,0,0}},
    {{1,0,0,0},
     {1,0,0,0},
     {1,0,0,0},
     {1,0,0,0}},
    {{1,1,1,1},
     {0,0,0,0},
     {0,0,0,0},
     {0,0,0,0}},
    {{0,1,0,0},
     {1,1,0,0},
     {1,0,0,0},
     {0,0,0,0}},
    {{1,1,0,0},
     {0,1,1,0},
     {0,0,0,0},
     {0,0,0,0}},
    {{1,0,0,0},
     {1,1,0,0},
     {0,1,0,0},
     {0,0,0,0}},
    {{0,1,1,0},
     {1,1,0,0},
     {0,0,0,0},
     {0,0,0,0}}
};

int main(){
    while(1){
        int field[8][8];
        int i=0, j=0;
        string row;
        while(cin >> row){
            for(j=0;j<8;j++){
                field[i][j] = (int)(row[j]-'0');
            }
            i++;
            if(i==8)break;
        }
        if(i!=8)break;

        bool found = false;
        for(i=0;i<8;i++){
            for(j=0;j<8;j++){
                for(int n=0;n<7;n++){
                    bool fit = true;
                    for(int k=0;k<4;k++){
                        for(int l=0;l<4;l++){
                            if(block[n][k][l]==0)continue;
                            if(i+k>=8 || j+l>=8 || field[i+k][j+l]==0){
                                fit = false;
                                break;
                            }
                        }
                        if(!fit)break;
                    }
                    if(fit){
                        printf("%c\n", 'A'+n);
                        found = true;
                        break;
                    }
                }
                if(found) break;
            }
            if(found) break;
        }
    }

    return 0;
}

C++: #include <cstdio>

using namespace std;

const int xform[7][4] = {{0,1,0,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,1,0,-1}},
yform[7][4] = {{0,0,1,1},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,0,1,1}};

int main(void){
	int i, j, k, l, x, y;
	char str[8][9];
	while(scanf("%s",&str[0]) != EOF){
		for(i = 1;i < 8;i++){
			scanf("%s",str[i]);
		}
		for(i = 0;i < 8;i++){
			for(j = 0;j < 8;j++){
				if(str[i][j] == '1'){
					break;
				}
			}
			if(j != 8){
				break;
			}
		}
		x = j, y = i;
		for(i = 0;i < 7;i++){
			for(j = 0;j < 4;j++){
				if(0 > x + xform[i][j] || x + xform[i][j] >= 8 || 0 > y + yform[i][j] || y + yform[i][j] >= 8 || str[y + yform[i][j]][x + xform[i][j]] == '0')
					break;
			}
			if(j == 4){
				break;
			}
		}
		printf("%c\n",'A' + i);
		getchar();
		getchar();
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	char f[8][8];
	int x,y,i,j;
	while(1)
	{
		x=y=-1;
		for(i=0;i<8;i++)cin >> f[i];
		if(cin.eof())break;
		for(x=0;x<8;x++)
		{
			for(y=0;y<8;y++)
			{
				if(f[x][y]=='1')
				{
					i=x;
					j=y;
					break;
				}
			}
			if(i==x&&j==y)break;
		}
		if(i<7&&j<7&&f[i+1][j]=='1'&&f[i][j+1]=='1')printf("A\n");
		else if(i<5&&f[i+3][j]=='1')printf("B\n");
		else if(j<5&&f[i][j+3]=='1')printf("C\n");
		else if(i<6&&j>0&&f[i+2][j-1]=='1')printf("D\n");
		else if(i<7&&j<6&&f[i+1][j+2]=='1')printf("E\n");
		else if(i<6&&j<7&&f[i+2][j+1]=='1')printf("F\n");
		else if(i<7&&j<7&&j>0&&f[i][j+1]=='1'&&f[i+1][j-1]=='1')printf("G\n");
	}
	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;
		}

	}


	return 0;
}