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

C++: #include<iostream>
using namespace std;
int main() {
	char c[10][10];
    while (cin>>c[0][0]){
        for (int i = 0; i < 8; i++)
            for (int j = 0; j < 8; j++)
                if(i==0&&j==0)continue;
                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 << 'B';
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>

char data[8][8];
int px, py;

int main(){
	while (true){
		for(int i = 0; i < 8 ; i++){
			for(int j = 0; j < 8; j++){
				if(!(std::cin >> data[i][j]))break;
				if(data[i][j] == '1')px = j, py = i;
			}
		}

		if (data[py][px - 1] == '1' && data[py - 1][px] == '1' && data[py - 1][px - 1] == '1')printf("A\n");
		else if (data[py - 1][px] == '1' && data[py - 2][px] == '1' && data[py - 3][px] == '1')printf("B\n");
		else if (data[py][px - 1] == '1' && data[py][px - 2] == '1' && data[py][px - 3] == '1')printf("C\n");
		else if (data[py][px - 1] == '1' && data[py + 1][px - 1] == '1' && data[py - 1][px] == '1')printf("D\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py - 1][px - 2] == '1')printf("E\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py + 1][px] == '1')printf("F\n");
		else if (data[py - 1][px] == '1' && data[py - 1][px + 1] == '1' && data[py][px - 1] == '1')printf("G\n");
	}     
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int dx[7][4]={{0,0,1,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,-1,0,1}};
int dy[7][4]={{0,1,1,0},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,1,1,0}};
string MAP[8];
string ans="ABCDEFG";

int main(){
	while(1){
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			cin >> MAP[i][j];
		}
	}
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			if(MAP[i][j]=='1'){
				for(int k=0; k<7; ++k){
					bool ok=true;
					for(int l=0; l<4; ++l){
						int nx=j+dx[k][l];
						int ny=i+dy[k][l];
						if((0<=nx&&nx<8&&0<=ny&&ny<8&&MAP[ny][nx]!='1')||(nx<0||8<=nx||ny<0||8<=ny)){
							ok=false;
							break;
						}
					}
					if(ok){
						cout << ans[k] << "\n";
						break;
					}
				}
			}
		}
	}
	}
	return 0;
}

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

int main(){
	int mass[8][8];
	
	BEGIN:
	while(scanf("%d%d%d%d%d%d%d%d",(*mass[0]),(*mass[0])+1,(*mass[0])+2,(*mass[0])+3,(*mass[0])+4,
		(*mass[0])+5,(*mass[0])+6,(*mass[0])+7)!=EOF)
	{
		for(int i=1;i<8;i++){
			scanf("%d%d%d%d%d%d%d%d",(*mass[i]),(*mass[i]+1),(*mass[i]+2),(*mass[i]+3),(*mass[i]+4),
				(*mass[i]+5),(*mass[i]+6),(*mass[i]+7));
		}
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(mass[i][j]){
					if(j==7){
						if(mass[i+1][j]){
							cout<<(mass[i+1][j-1]?"D\n":"B\n");
						}
					}else if(j==0){
						if(mass[i][j+1]){
							if(mass[i+1][j]) cout<<"A\n";
							else if(mass[i][j+2]) cout<<"C\n";
							else cout<<"E\n";
						}
						else cout<<(mass[i+1][j+1]?"F\n":"B\n");
					}else{
						if(mass[i][j+2]) cout<<"C\n";
						else if(mass[i][j+1]){
							if(mass[i+1][j]){
								cout<<(mass[i+1][j+1]?"A\n":"G\n");
							}
							else cout<<"E\n";
						}
						else if(mass[i+2][j]) cout<<"B\n";
						else cout<<(mass[i+1][j+1]?"F\n":"D\n");
					}
					goto BEGIN;
				}
			}
		}
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
string str[8]; 
void ans(int i,int k){
	if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k] == '1' ){
		cout << "A" << endl;  
		} else if(str[i+1][k] == '1' && str[i+2][k] == '1'&& str[i+3][k] == '1' ){
		cout << "B" << endl; 
		} else if(str[i][k+1] == '1' && str[i][k+2] == '1'&& str[i][k+3] == '1' ){
		cout << "C" << endl;  
		} else if(str[i+1][k] == '1' && str[i+1][k-1] == '1'&& str[i+2][k-1] == '1' ){
		cout << "D" << endl; 
		} else if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k+2] == '1' ){
		cout << "E" << endl; 
		} else if(str[i+1][k] == '1' && str[i+1][k+1] == '1'&& str[i+2][k+1] == '1' ){
		cout << "F" << endl;  
		} else if(str[i][k+1] == '1' && str[i+1][k] == '1'&& str[i+1][k-1] == '1' ){
		cout << "G" << endl; 
		}



}

int main(){
	
	while(1){
	
	for(int i =0;i<8;i++)
		if(!(cin>>str[i]))return 0;
	
	
	for(int i=0;i<64;i++)
	
	if(str[i/8][i%8] == '1')
	ans(i/8,i%8);
	

	
	}
	
}