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

using namespace std;

char fig [9][9];

int main()
{
	
	while (scanf("%s", fig[0]) != EOF){
		for (int i = 1; i < 8; i++){
			scanf("%s", fig[i]);
		}
		
		for (int y = 0; y < 8; y++){
			for (int x = 0; x < 8; x++){
				if (fig[y][x] != '0'){
					if (fig[y][x + 1] == '1' && fig[y + 1][x] == '1' && fig[y + 1][x + 1] == '1'){
						printf("A\n");
						y = 10;
						break;
					}
					else if(fig[y + 1][x] == '1' && fig[y + 2][x] == '1' && fig[y + 3][x] == '1'){
						printf("B\n");
						y = 10;
						break;
					}
					else if(fig[y][x + 1] == '1' && fig[y][x + 2] == '1' && fig[y][x + 3] == '1'){
						printf("C\n");
						y = 10;
						break;
					}
					else if(fig[y + 1][x] == '1' && fig[y + 1][x - 1] == '1' && fig[y + 2][x - 1] == '1'){
						printf("D\n");
						y = 10;
						break;
					}
					else if(fig[y][x + 1] == '1' && fig[y + 1][x + 1] == '1' && fig[y + 1][x + 2] == '1'){
						printf("E\n");
						y = 10;
						break;
					}
					else if(fig[y + 1][x] == '1' && fig[y + 1][x + 1] == '1' && fig[y + 2][x + 1] == '1'){
						printf("F\n");
						y = 10;
						break;
					}
					else if(fig[y][x + 1] == '1' && fig[y + 1][x] == '1' && fig[y + 1][x - 1] == '1'){
						printf("G\n");
						y = 10;
						break;
					}
				}
			}
		}
	}
}