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 <iostream>
#include <vector>
#include <string>
using namespace std;

string field[8];

bool ch(int i,int j)
{
	if(field[i][j] == '1') return true;
	return false;
}

bool Check_A(int i,int j)
{
	if(i+1 < 8 && j+1 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j+1))  return true;
	}
	return false;
}

bool Check_B(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i+3,j)) return true;
	}
	return false;
}

bool Check_C(int i,int j)
{
	if(j+1 < 8 && j+2 < 8 && j+3 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i,j+2) && ch(i,j+1)) return true;
	}
	return false;
}

bool Check_D(int i,int j)
{
	if(j-1 > 0 && i+1 < 8 && i+2 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i,j-1)) return true;
	}
	return false;
}

bool Check_E(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j+2 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i+1,j+1) && ch(i+1,j+2)) return true;
	}
	return false;
}

bool Check_F(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+1,j+1)&& ch(i+2,j+1)) return true;
	}
	return false;
}

bool Check_G(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j-1 > 0)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j-1)) return true;
	}
	return false;
}

int main()
{
	while(true)
	{
		if(cin.eof()) break;

		for(int i=0;i<8;i++)
		{
			cin >> field[i];
		}
		
		bool flag = true;
		for(int i=0;i<8;i++)
		{
			for(int j=0;j<8;j++)
			{
				if(Check_A(i,j) && flag)
				{
					cout << "A" << endl;
					flag = false;
				}

				if(Check_B(i,j) && flag)
				{
					cout << "B" << endl;
					flag = false;
				}

				if(Check_C(i,j) && flag)
				{
					cout << "C" << endl;
					flag = false;
				}

				if(Check_D(i,j) && flag)
				{
					cout << "D" << endl;
					flag = false;
				}				

				if(Check_E(i,j) && flag)
				{
					cout << "E" << endl;
					flag = false;
				}

				if(Check_F(i,j) && flag)
				{
					cout << "F" << endl;
					flag = false;
				}

				if(Check_G(i,j) && flag)
				{
					cout << "G" << endl;
					flag = false;
				}
			}
		}
	}
	return 0;
}

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


using namespace std;

int main()
{
	int dx[7][3] = 
	{
		{ 1, 0, 1 },
		{ 0, 0, 0 },
		{ 1, 2, 3 },
		{ -1, 0, -1 },
		{ 1, 1, 2 },
		{ 0, 1, 1 },
		{ 1, -1, 0 }
	};
	int dy[7][3] =
	{
		{ 0, 1, 1 },
		{ 1, 2, 3 },
		{ 0, 0, 0 },
		{ 1, 1, 2 },
		{ 0, 1, 1 },
		{ 1, 1, 2 },
		{ 0, 1, 1 },
	};

	char bb[256];
	char* next = (char*)1;
	while (next)
	{
		char buf[8][8];
		int i;
		for (i = 0; i < 8; ++i)
		{
			if (fgets(bb, 256, stdin) == NULL)
				break;
			for (int j = 0; j < 8; ++j)
				buf[i][j] = bb[j];
		}
		next = fgets(bb, 256, stdin);
		if (i != 8)
			break;

		int x, y;
		for (y = 0; y < 8; ++y)
		{
			for (x = 0; x < 8; ++x)
			{
				if (buf[y][x] == '1')
					break;
			}
			if (buf[y][x] == '1')
				break;
		}

		for (i = 0; i < 7; ++i)
		{
			int j;
			for (j = 0; j < 3; ++j)
			{
				int tx = x+dx[i][j];
				int ty = y+dy[i][j];
				if (tx < 0 || ty < 0 || tx >= 8 || ty >= 8
					|| buf[ty][tx] == '0')
					break;
			}
			if (j == 3)
			{
				break;
			}
		}
		printf("%c\n", "ABCDEFG"[i]);
	}

	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const char dat[7][4][5] = {
    { "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" },
};

char f[16][16];

bool match(int k, int x, int y) {
    rep (i, 4) rep (j, 4) if (f[x+i][y+j] != dat[k][i][j]) return false;
    return true;
}

int solve() {
    rep (k, 7) rep (i, 8) rep (j, 8) if (match(k, i, j)) return k;
    return -1;
}

int main() {
    memset(f, '0', sizeof(f));
    while (scanf(" %c", f[0]) != EOF) {
        rep (i, 8) rep (j, 8) if (i || j) scanf(" %c", f[i]+j);
        printf("%c\n", (char)('A'+solve()));
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
bool check(int (&field)[8][8],int x,int y){
	if(x<0 || x>=8 || y<0 || y>=8 || (field[y][x] == 0)){
		return false;
	}
	return true;
}

int main(){
	int inptf[8][8] = {0}, i, j, x, y;
	string str;
	char btype;
	while(true){
		i=0;
		while(cin>>str){
			for(j=0;j<8;j++){
				inptf[i][j] = str[j] - '0';
			}
			i++;
			if(i==8) break;
		}
		if(i<8) break;
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				if(inptf[i][j] != 0){
					y = i;
					x = j;
					i=j=8;
				}
			}
		}
		if(check(inptf , x, y) &&	//[][] A
		   check(inptf , x, y+1) &&	//[][]
		   check(inptf , x+1, y) &&	
		   check(inptf , x+1, y+1))	
			btype='A';
			
		if(check(inptf , x, y) &&	//[] B
		   check(inptf , x, y+1) &&	//[]
		   check(inptf , x, y+2) &&	//[]
		   check(inptf , x, y+3))	//[]
			btype='B';
		if(check(inptf , x, y) &&	//[][][][] C
		   check(inptf , x+1, y) &&	
		   check(inptf , x+2, y) &&	
		   check(inptf , x+3, y))	
			btype='C';
		if(check(inptf , x, y) &&	//  [] D
		   check(inptf , x, y+1) &&	//[][]
		   check(inptf , x-1, y+1) &&	//[]
		   check(inptf , x-1, y+2) )	
			btype='D';
		if(check(inptf , x, y) &&	//[][] E
		   check(inptf , x+1, y) &&	//  [][]
		   check(inptf , x+1, y+1) &&	
		   check(inptf , x+2, y+1))	
			btype='E';
		if(check(inptf , x, y) &&	//[]   F
		   check(inptf , x, y+1) &&	//[][]
		   check(inptf , x+1, y+1) &&	//  []
		   check(inptf , x+1, y+2))	
			btype='F';
		if(check(inptf , x, y) &&	//  [][]G
		   check(inptf , x+1, y) &&	//[][]
		   check(inptf , x, y+1) &&
		   check(inptf , x-1, y+1))	
			btype='G';
		cout<<btype<<endl;
	}
}