Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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 ROW 8
#define COLUMN 8

void get_ans( string *matrix_str , char& ans );

int main(void)
{
	int matrix[ROW][COLUMN];
	string matrix_str[COLUMN];
	char c;

	while(1)
	{
		char ans = '0';
		int flag = 0; // 二重ループ脱出用
		for( int i = 0 ; i < COLUMN ; i++ )
		{
			cin >> matrix_str[i];
			if( cin.eof() )
			{
				flag = 1;
				break;
			}
		}
		if( flag == 1 )
		{
			break;
		}
		get_ans( matrix_str , ans );
		cout << ans << endl;
	}

	return 0;
}

void get_ans( string *matrix_str , char& ans )
{
	for( int i = 0 ; i < ROW ; i++ )
	{
		for( int j = 0 ; j < COLUMN ; j++ )
		{
			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+1].at(j+1) == '1' )
			{
				ans = 'A';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+2].at(j) == '1' &&
				matrix_str[i+3].at(j) == '1' )
			{
				ans = 'B';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i].at(j+2) == '1' &&
				matrix_str[i].at(j+3) == '1' )
			{
				ans = 'C';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j-1) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+2].at(j-1) == '1' )
			{
				ans = 'D';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j+1) == '1' &&
				matrix_str[i+1].at(j+2) == '1' )
			{
				ans = 'E';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+1].at(j+1) == '1' &&
				matrix_str[i+2].at(j+1) == '1' )
			{
				ans = 'F';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j-1) == '1' &&
				matrix_str[i+1].at(j) == '1' )
			{
				ans = 'G';
			}
		}
	}
	return;
}

C++: #include <iostream>

#define limit(A,X,C) ((X<A)?A:(C<X)?C:X)

char map[8+1][8]={'0'};

int pget(int x,int y)
{
	if(limit(0,x,7)==x && limit(0,y,7)==y)
		return map[y][x]-'0';
	return 0;
}

char check(int x, int y)
{
//	std::cout << ":" << x << y << std::endl;
	if(pget(x+1,y))
	{
		if(pget(x+2,y))
			return 'C';
		if(!pget(x,y+1))
			return 'E';
		if(pget(x+1,y+1))
			return 'A';
		return 'G';
	}
	if(pget(x,y+2))
		return 'B';
	if(pget(x+1,y+2))
		return 'F';
	return 'D';
}

int main(void)
{
	do
	{
		for(int i=0; i<8; i++)
			if(!(std::cin >> map[i]))
				return 0;
		int x,y;
		bool end=false;
		for(y=0; y<8; y++)
		{
			for(x=0; x<8; x++)
				if(map[y][x] == '1')
				{
					end=true;
					break;
				}
			if(end)
				break;
		}

		std::cout << check(x,y) << std::endl;
	}while(std::cin.getline(map[0],sizeof(map[0])));
	
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
string s[8];
void f(){
	char b='A';
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]=='1'){
				if(i<5)if(s[i+3][j]=='1')b='B';
				if(j<5)if(s[i][j+3]=='1')b='C';
				if(i<6&&j>0)if(s[i+2][j-1]=='1')b='D';
				if(j<6)if(s[i+1][j+2]=='1')b='E';
				if(i<6)if(s[i+2][j+1]=='1')b='F';
				if(j>0)if(s[i+1][j-1]=='1')b='G';
				cout<<b<<endl;
				return;
			}
		}
	}
}

int main(){
	while(cin>>s[0]){
		for(int i=1;i<8;i++)cin>>s[i];
		f();
	}
	return 0;
}

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

int main(){
    char boa[8][8];
    while(1){
        
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(!(cin>>boa[i][j]))
                    return 0;
            }
        }
        int bo[8][8];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                bo[i][j]=boa[i][j]-'0';
            }
        }
            
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(bo[i][j]==1){
                    if(i<7&&j<7){
                        if(bo[i+1][j]==1&&bo[i][j+1]==1&&bo[i+1][j+1]){
                            cout<<"A"<<endl;
                            goto next;
                        }
                    }
                    if(j<5){
                        if(bo[i][j+1]&&bo[i][j+2]&&bo[j+3]){
                            cout<<"C"<<endl;goto next;
                        }
                            
                    }
                    if(i<5){
                        if(bo[i+1][j]&&bo[i+2][j]&&bo[i+3][j]){
                            cout<<"B"<<endl;goto next;
                        }
                        
                    }
                    if(i<7&&i>0&&j<7){
                        if(bo[i+1][j]&&bo[i][j+1]&&bo[i-1][j+1]){
                            cout<<"D"<<endl;goto next;
                        }
                    }
                    if(i<7&&j<6){
                        if(bo[i][j+1]&&bo[i+1][j+1]&&bo[i+1][j+2]){
                            cout<<"E"<<endl;goto next;
                        }
                    }
                    if(i<6&&j<7){
                        if(bo[i+1][j]&&bo[i+1][j+1]&&bo[i+2][j+1]){
                            cout<<"F"<<endl;goto next;
                        }
                    }
                    if(i<7&&j>0&&j<7){
                        if(bo[i+1][j]&&bo[i+1][j-1]&&bo[i][j+1]){
                            cout<<"G"<<endl;goto next;
                        }
                    }
                    
                }
            }
        }
        
    next:;
    }
    
    return 0;
}