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<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>

struct 
{} undefined;

template <typename T , unsigned H , unsigned W>
auto input (T (& a) [H] [W]) -> bool
{
    bool result = static_cast <bool> (std::cin >> a [0] [0]);
    if (! result)
    {
        return false;
    }
    for (auto x = 1u; x < W; ++ x)
    {
        std::cin >> a [0] [x];
    }
    for (auto y = 1u; y < H; ++ y)
    {
        for (auto x = 0u; x < W; ++ x)
        {
            std::cin >> a [y] [x];
        }
    }
    return true;
}

template <unsigned H , unsigned W>
auto at (char (& a) [H] [W] , unsigned x , unsigned y) -> bool
{
    if (0 <= x && x < W && 0 <= y && y < H)
    {
        return a [y] [x] == '1';
    }
    else
    {
        return false;
    }
}

template <unsigned H , unsigned W>
auto check (char (& a) [H] [W]) -> char
{
    for (auto y = 0u; y < H; ++ y)
    {
        for (auto x = 0u; x < W; ++ x)
        {
            if (at (a , x , y))
            {
                // ??????????????? -> A,C,E,G
                if (at (a , x + 1 , y))
                {
                    // ??????????????? -> A,G
                    if (at (a , x , y + 1))
                    {
                        // ??????????????????????????? -> A
                        if (at (a , x + 1 , y + 1))
                        {
                            return 'A';
                        }
                        // ??????????????????????????? -> G
                        else
                        {
                            return 'G';
                        }
                    }
                    // ??????????????? -> C,E
                    else
                    {
                        // 2??????????????? -> C
                        if (at (a , x + 2 , y))
                        {
                            return 'C';
                        }
                        // 2?????????????????? -> E
                        else
                        {
                            return 'E';
                        }
                    }
                }
                // ??????????????? -> B,D,F
                else
                {
                    // 2??????????????? -> B
                    if (at (a , x , y + 2))
                    {
                        return 'B';
                    }
                    // ???????????????????????? -> F
                    else if (at (a , x + 1 , y + 1))
                    {
                        return 'F';
                    }
                    // ???????????????
                    else
                    {
                        return 'D';
                    }
                }
                throw undefined;
            }
        }
    }
    return 'X';
}

auto main () -> int
{
    char a [8] [8];
    while (input (a))
    {
        std::cout << check (a) << std::endl;
    }
}

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

int main(){
	char area[8][8];
	char c;
	while(cin >> c){
		while(!isalnum(c)) cin >> c;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				area[i][j] = c;
				if(i ==  7 && j == 7) break;
				cin >> c;
			}
		}
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(area[i][j] == '1'){
					if(i+1 < 8 && area[i+1][j] == '1'){
						if(i+2 < 8 && area[i+2][j] == '1'){
							if(i+3 < 8 && area[i+3][j] == '1'){
								cout << "B";
							}
						}
						if(j+1 < 8 && area[i+1][j+1] == '1'){
							if(i+2 < 8 && area[i+2][j+1] == '1'){
								cout << "F";
							}
							if(area[i][j+1] == '1'){
								cout << "A";
							}
							if(j-1 >= 0 && area[i+1][j-1] == '1'){
								cout << "G";
							}
						}
						if(j+1 < 8 && area[i][j+1] == '1'){
							if(i-1 >= 0 && area[i-1][j+1] == '1'){
								cout << "D";
							}
						}
					}else if(j+1 < 8 && area[i][j+1] == '1'){
						if(j+2 < 8 && area[i][j+2] == '1'){
							if(j+3 < 8 && area[i][j+3] == '1'){
								cout <<"C";
							}
						}
						if(i+1 < 8 && area[i+1][j+1] == '1'){
							if(j+2 < 8 && area[i+1][j+2] == '1'){
								cout << "E";
							}
						}
					}
				}
			}
		}
		cout << endl;
	}
	return 0;
}