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++: //0036
#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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

char judge( vector<string> surface )
{
	for ( unsigned int i = 0; i < surface.size(); i++ )
	{
		for ( unsigned int j = 0; j < surface[i].length(); j++ )
		{
			if ( surface[i][j] == '1' )
			{
				// A
				if ( surface[i][j+1] == '1' && surface[i+1][j] == '1' && surface[i+1][j+1] == '1' )
				{
					return 'A';
				}
				// B
				else if ( surface[i+1][j] == '1' &&surface[i+2][j] == '1' &&surface[i+3][j] == '1' )
				{
					return 'B';
				}
				// C
				else if ( surface[i][j+1] == '1' && surface[i][j+2] == '1' && surface[i][j+3] == '1' )
				{
					return 'C';
				}
				// D
				else if ( surface[i+1][j] == '1' && surface[i+1][j-1] == '1' && surface[i+2][j-1] == '1' )
				{
					return 'D';
				}
				// E
				else if ( surface[i][j+1] == '1' && surface[i+1][j+1] == '1' && surface[i+1][j+2] == '1' )
				{
					return 'E';
				}
				// F
				else if ( surface[i+1][j] == '1' && surface[i+1][j+1] == '1' && surface[i+2][j+1] == '1' )
				{
					return 'F';
				}
				// G
				else if ( surface[i][j+1] == '1' && surface[i+1][j-1] == '1' && surface[i+1][j] == '1' )
				{
					return 'G';
				}
				else
				{
					return '-';
				}
			}
		}
	}

	return '-';
}

int main()
{
	while ( true )
	{
		string buffer;
		vector<string> surface;

		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );

		for ( int i = 0; i < 8; i++ )
		{
			if ( cin >> buffer )
			{
				surface.push_back( "000" + buffer + "000" );
			}
			else
			{
				return 0;
			}
		}

		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );

		cout << judge( surface ) << endl;
	}
	
	return 0;
}

C++: 00000000
00000000
01100000
00110000
00000000
00000000
00000000
00000000

00011110
00000000
00000000
00000000
00000000
00000000
00000000
00000000

00000000
00000000
00110000
00110000
00000000
00000000
00000000
00000000

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

int main(){
	char a[8][8];
	while(cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[0][3] >> a[0][4] >> a[0][5] >> a[0][6] >> a[0][7]){
		int p, q;
		for(int i = 1; i < 8; i++){
			for(int j = 0; j < 8; j++){
				cin >> a[i][j];
			}
		}
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(a[i][j] == '1'){
					p = i;
					q = j;
					goto LABEL;
				}
			}
		}
		LABEL:
		if(a[p][q+2] == '1'){
			cout << "C" << endl;
		}
		else if(a[p+2][q] == '1'){
			cout << "B" << endl;
		}
		else if(a[p+2][q+1] == '1'){
			cout << "F" << endl;
		}
		else if(a[p+1][q+2] == '1'){
			cout << "E" << endl;
		}
		else if(a[p+1][q+1] == '1'){
			cout << "A" << endl;
		}
		else if(a[p][q+1] == '1'){
			cout << "G" << endl;
		}
		else{
			cout << "D" << endl;
		}
	}
}

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 {
				cout << "E";
			}
		} else if (map[y - 1][x - 1] == 1) {
			if (map[y][x + 1] == 1) {
				cout << "G";
			} else {
				cout << "D";
			}
		} else if (map[y + 3][x]) {
			cout << "B";
		} else {
			cout << "C";
		}
		cout << endl;

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

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

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

char t[10][10];
int w = 8;
int h = 8;

int dx[][4] = {
  {0,1,0,1},
  {0,0,0,0},
  {0,1,2,3},
  {0,-1,0,-1},
  {0,1,1,2},
  {0,0,1,1},
  {0,1,-1,0},
};
int dy[][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},
};

bool check(int y,int x,int kind){
  for(int i=0;i<4;i++){
    int nx = x + dx[kind][i];
    int ny = y + dy[kind][i];
    if(nx>=0 && nx<w && ny>=0 && ny<h){
        if(t[ny][nx] != '1'){
          return false;
        }
    }
      else{
        return false;
        }
  }
    return true;
}

void solve(){
  rep(i,h){
    rep(j,w){
      rep(k,7){
        int tmp = check(i,j,k);
        if(tmp){
          cout<<(char)('A'+k)<<endl;
          return;
        }
      }
    }
  }
}

int main(){
  while(1){
    rep(i,h){
      if(!(cin>>t[i])) return 0;
    }
    solve();
  }
}