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)
		fmt.Scanln()
	}
}

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

struct Point{
public:
	int x,y;
	Point(int _x, int _y){x=_x;y=_y;}
	void show(){cout<<x<<","<<y<<endl;}
	bool eq(Point &a){return x==a.x && y==a.y;}
};

bool eqFig(vector<Point> &a, vector<Point> &b){
	if(a.size()!=b.size()){
		return false;
	}else{
		vector<Point>::iterator ita=a.begin(), itb=b.begin();
		for(;ita<a.end();++ita,++itb){
			if(!(ita->eq(*itb))){
				return false;
			}
		}
		return true;
	}
}

int main() {
	vector< vector<Point> > figs = { 
		{Point(0,0),Point(1,0),Point(0,1),Point(1,1)},
		{Point(0,0),Point(0,1),Point(0,2),Point(0,3)},
		{Point(0,0),Point(1,0),Point(2,0),Point(3,0)},
		{Point(0,0),Point(-1,1),Point(0,1),Point(-1,2)},
		{Point(0,0),Point(1,0),Point(1,1),Point(2,1)},
		{Point(0,0),Point(0,1),Point(1,1),Point(1,2)},
		{Point(0,0),Point(1,0),Point(-1,1),Point(0,1)}
	};
	vector<Point>fig;
	unsigned char ch;
	
	do{
		fig.clear();
		int x=0,y=0,sx;
		bool flg=false;
		
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				ch = getchar();
				if(ch == '1'){
					fig.push_back(Point(x,y));
					if(!flg)sx = j;
					flg = true;
				}
				if(flg){
					x = 1 + j - sx;
				}
			}
			if(flg)++y;
			getchar();
		}
		
		for(int i=0;i<7;++i){
			if(eqFig(figs[i],fig)){
				cout<<(char)('A'+i)<<endl;
				break;
			}
		}
		
	}while(getchar()!=EOF);
	return 0;
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (true) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		int map[14][14], x = SIZE, y = SIZE;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = ((source[i][j] == '1') ? 1 : 0);
				if (source[i][j] == '1' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] == 1) {
			if (map[y][x + 1] == 1 && map[y + 1][x] == 1) {
				cout << "A";
			} else if (map[y + 2][x + 1] == 1) {
				cout << "F";
			} else if (map[y + 1][x + 2] == 1) {
				cout << "E";
			}
		} else if (map[y - 1][x - 1] == 1) {
			if (map[y][x + 1] == 1) {
				cout << "G";
			} else if (map[y + 2][x - 1] == 1) {
				cout << "D";
			}
		} else if (map[y + 3][x]) {
			cout << "B";
		} else {
			cout << "C";
		}
		cout << endl;

		if (cin.eof()) break;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (cin >> s) {
		vector<string>v;
		v.push_back(s);
		rep(i, 0, 7) {
			string t; cin >> t;
			v.push_back(t);
		}
		char ans;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (v[i][j] == '1') {
					if (j + 1 < 8 && i + 1 < 8 && v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (i + 3 < 8 && v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (j + 3 < 8 && v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (i + 1 < 8 && j + 2 < 8 && v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (i + 2 < 8 && j + 1 < 8 && v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (i + 2 < 8 && j - 1 >= 0 && v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else //if (i - 1 >= 0 && i + 1 < 8 && j + 1 < 8 && v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i - 1][j - 1] == '1')
						ans = 'G';
					goto here;
				}
			}
		}
	here:;
		cout << ans << endl;
	}
	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)
		{
			bool found = false;
			for (x = 0; x < 8; ++x)
			{
				if (buf[y][x] == '1')
				{
					found = true;
					break;
				}
			}
			if (found)
				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)
			{
				printf("%c\n", 'A' + i);
				break;
			}
		}
	}

	return 0;
}