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 <string>
using namespace std;

#define SAFE_DELETE( x ) { if ( x ){ delete x; x = NULL; } }
#define SAFE_DELETE_ARRAY( x ) { if ( x ){ delete[] x; x = NULL; } }

struct tCell{
	tCell() : board( NULL ), prev( NULL ), next( NULL ){}

	int* board;
	tCell *prev, *next;
};

class MyArray{
public:
	MyArray() : mSize( 0 ), head( NULL ), tail( NULL ){
		head = new tCell;
		tail = new tCell;
		head->next = tail;
		tail->prev = head;
	}
	~MyArray(){
		for ( int i = mSize; i > 0; --i ){
			tCell* cell = tail->prev;
			SAFE_DELETE_ARRAY( cell->board );
			cell->prev->next = cell->next;
			cell->next->prev = cell->prev;
			SAFE_DELETE( cell );
		}
		SAFE_DELETE( tail );
		SAFE_DELETE( head );
	}

	void pushBack( int* b ){
		++mSize;
		tCell* cell = new tCell;
		cell->board = b;
		cell->prev = tail->prev;
		cell->next = tail;
		cell->prev->next = cell;
		cell->next->prev = cell;
	}
	int size(){ return mSize; }

	tCell operator[]( int d ){
		tCell* cell = head->next;
		if ( d >= mSize ){
			cell = NULL;
			return *cell;
		}
		for ( int i = 0; i < d; ++i ){
			cell = cell->next;
		}
		return *cell;
	}

private:
	int mSize;
	tCell *head, *tail;
};

string checkModel( int* b ){
	string model;
	bool find = false;
	int x = 0, y = 0;
	for ( y = 0; y < 10; ++y ){
		for ( x = 0; x < 10; ++x ){
			if( b[ y*10 + x ] ){
				find = true;
				break;
			}
		} if ( find ) break;
	}

	if ( b[ y*10 + ( x+1 ) ] ){	//model A, C, E, G
		if ( b[ y*10 + ( x+2 ) ] ){	//model C
			model = "C";
		}else if ( b[ ( y+1 )*10 + ( x-1 ) ] ){	//model G
			model = "G";
		}else if ( b[ ( y+1 )*10 + ( x+2 ) ] ){	//model E
			model = "E";
		}else{	//model A
			model = "A";
		}
	}else{	//model B, D, F
		if ( b[ ( y+2 )*10 + x ] ){	//model B
			model = "B";
		}else if ( b[ (y+2)*10 + ( x-1 ) ] ){	//model D
			model = "D";
		}else{	//model F
			model = "F";
		}
	}

	return model;
}

int main(){
	bool first = true;
	int cnt = 0;
	int* board;
	string s;
	MyArray ma;

	while ( cin >> s ){
		if( first ){
			board = new int[ 10 * 10 ];
			for ( int i = 0; i < 10*10; ++i ){
				board[ i ] = 0;
			}
			cnt = 0;
			first = false;
		}
		for ( int i = 0; i < 8; ++i ){
			board[ (cnt+1)*10 + i+1 ] = static_cast< int >( s[ i ] - '0' );
		}

		++cnt;
		if ( cnt == 8 ){
			ma.pushBack( board );
			board = NULL;
			first = true;
		}
	}

	for ( int i = 0; i < ma.size(); ++i ){
		cout << checkModel( ma[ i ].board ) << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	while (!cin.eof()) {
		char c[8][8];
		for (int i = 0; i < 8; i++)
			for (int j = 0; j < 8; j++)
				cin >> c[i][j];
		int a, b;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (c[i][j] == '1') {
					a = i;
					b = j;
					goto C;
				}
			}
		}
	C:
		if (c[a][b + 1] == '1') 
			if (c[a + 1][b] == '1') 
				if (c[a + 1][b + 1] == '1')
					cout << 'A';
				else cout << 'G';
			else
				if (c[a + 1][b + 1] == '1')
					cout << 'E';
				else cout << 'C';
		else if (c[a + 1][b + 1] == '1')
			cout << 'F';
		else if (c[a - 1][b + 1] == '1')
			cout << 'D';
		else cout << 'C';
		cout << endl;
	}
}

C++: #include <iostream>
#include <cstring>
using namespace std;
struct P {int x, y; char s[4][5];};
char f[8][9] = {{""}};
bool c(int x, int y, P p)
{
	int i, j;
	char t[8][9];
	for (i = 0; i < 8; i++)
		strcpy(t[i], f[i]);
	for (i = 0; i < p.y; i++)
	{
		for (j = 0; j < p.x; j++)
		{
			t[y+i][x+j] = p.s[i][j];
		}
	}
	for (i = 0; i < 8; i++)
		if (strcmp(t[i], f[i]) != 0)
		{
			return false;
		}
	return true;
}
int main()
{
	P p[7] = {2, 2, {"11", "11"},
		1, 4, {"1", "1", "1", "1"},
		4, 1, {"1111"},
		2, 3, {"01", "11", "10"},
		3, 2, {"110", "011"},
		2, 3, {"10", "11", "01"},
		3, 2, {"011", "110"}};
	int i, j, k;
	bool b;
	char res;
	while (!cin.eof())
	{
		for (i = 0; i < 8; i++)
			cin >> f[i];
		cin.get();
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 8; j++)
			{
				for (k = 0; k < 7; k++)
				{
					if (8-j >= p[k].x && 8-i >= p[k].y)
						if (b = c(j, i, p[k]))
							res = 'A' + k;
				}
				if (b) break;
			}
			if (b) break;
		}
		cout << res << endl;
	}
}

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

int xb[7][3] = {
	{1, 0, 1},
	{0, 0, 0},
	{1, 2, 3},
	{0, -1, -1},
	{1, 1, 2},
	{0, 1, 1},
	{1, 0, -1}
};

int yb[7][3] = {
	{0, 1, 1},
	{1, 2, 3},
	{0, 0, 0},
	{1, 1, 2},
	{0, 1, 1},
	{1, 1, 2},
	{0, 1, 1}
};

int main() {
	string field[8];
	while(getline(cin, field[0])) {
		for(int i = 1; i < 8; i++) getline(cin, field[i]);

		char ans = '\0';
		rep(y,8) {
			rep(x,8) {
				if(field[y][x] == '1') {
					// cerr << "x: " << x << " " << "y: " << y << endl;
					rep(i,8) {
						bool f = true;
						rep(j,3) {
							int nx = x + xb[i][j];
							int ny = y + yb[i][j];
#if 1
							if(!(0 <= nx && nx < 8 && 0 <= ny && ny < 8 && field[ny][nx] == '1')) {
								f = false;
								break;
							}
#endif
						}
						if(f) {
							ans = 'A' + i;
							goto END;
						}
					}
				}
			}
		}
	END:
		cout << ans << endl;
		getline(cin, field[0]);
	}
	return 0;
}