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++: #include <iostream>
#include <array>

using namespace std;

char checkData( array< int, 4 > data_i, array< int, 4 > data_j )
{
        int i = 0, j = 0;
        if (
                        data_i[i] + 1 == data_i[i+1] &&
                        data_j[j] == data_j[j+1] &&
                        data_i[i] == data_i[i+2] &&
                        data_j[j] + 1 == data_j[i+2] &&
                        data_i[i] + 1 == data_i[j+3] &&
                        data_j[j] + 1 == data_j[j+3]
           )
        {
                return 'A';
        }
        else if (
                        data_i[i] == data_i[i+1] &&
                        data_j[j] + 1 == data_j[j+1] &&
                        data_i[i] == data_i[i+2] &&
                        data_j[j] + 2 == data_j[j+2] &&
                        data_i[i] == data_i[i+3] &&
                        data_j[j] + 3 == data_j[j+3]
        )
        {
                return 'B';
        }
        else if (
                        data_i[i] + 1 == data_i[i+1] &&
                        data_j[j] == data_j[j+1] &&
                        data_i[i] + 2 == data_i[i+2] &&
                        data_j[j] == data_j[j+2] &&
                        data_i[i] + 3 == data_i[j+3] &&
                        data_j[j] == data_j[j+3]
        )
        {
                return 'C';
        }
        else if (
                        data_i[i] - 1 == data_i[i+1] &&
                        data_j[j] + 1 == data_j[j+1] &&
                        data_i[i] == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] - 1 == data_i[i+3] &&
                        data_j[j] + 2 == data_j[j+3]
        )
        {
                return 'D';
        }
        else if (
                        data_i[i] + 1 == data_i[i+1] &&
                        data_j[j] == data_j[j+1] &&
                        data_i[i] + 1 == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] + 2 == data_i[i+3] &&
                        data_j[j] + 1 == data_j[j+3]
        )
        {
                return 'E';
        }
        else if (
                        data_i[i] == data_i[i+1] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] + 1 == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] + 1 == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+3]
        )
        {
                return 'F';
        }
        else
        {
                return 'G';
        }


}


int main()
{
        char table[8][8];
        array< int, 4 > data_i;
        array< int, 4 > data_j;
        int tmp = 0, inum = 0, jnum = 0, i, j;

        while ( cin >> table[0] )
        {
                for ( i = 1 ; i < 8 ; i++ )
                {
                        cin >> table[i];
                }
                for ( i = 0 ; i < 8 ; i++ )
                {
                        for ( j = 0 ; j < 8 ; j++ )
                        {
                                if ( table[i][j] == '1' )
                                {
                                        data_i[inum] = i;
                                        data_j[jnum] = j;
                                        inum++;
                                        jnum++;
                                }
                        }
                }
                inum = 0;
                jnum = 0;
                cout << checkData( data_j, data_i ) << endl;
        }
        return 0;
}

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

int main(){
    char mat[8][8]={0};
    
    while(cin >> mat[0]){
        char ans;
        
        for(int i = 1; i < 8 ; i++) cin >> mat[i];
        
        for(int i = 0 ; i < 8 ; i++)
            for(int j = 0 ; j < 8 ; j++)
                mat[i][j] -= '0';
        
        for(int i = 0 ;  ; i++){
            for(int j = 0 ; j < 8 ; j++){
                if(mat[i][j] == 1){
                    if(mat[i][j+3]) ans = 'C';
                    else if(mat[i+3][j]) ans = 'B';
                    else if(mat[i][j+1]&&mat[i+1][j]) ans = 'A';
                    else if(mat[i+1][j-1]&&mat[i+1][j]) ans = 'D';
                    else if(mat[i][j+1]&&mat[i+1][j+2]) ans = 'E';
                    else if(mat[i+1][j]&&mat[i+1][j+2]) ans = 'F';
                    else ans = 'G';
                    
                    goto end;
                }
                
            }
        }
        end:
        cout << ans << endl;
        
        }

    
    return 0;
}