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++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	string str[8];

	bool x[8][8];
	
	while(cin >> str[0]){
		for(int i=1;i<8;i++){
			cin >> str[i];
		}
		
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(str[i][j]=='1'){
					x[i][j]=1;
				}else{
					x[i][j]=0;
				}
			}
		}

		bool flag = 0;
		
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(x[i][j]){
					if(!flag && j<5){
						if(x[i][j+1] && x[i][j+2] && x[i][j+3]){
							cout << "C" << endl;
							flag = 1;
						}
					}
					if(!flag && j<7){
						if(x[i][j+1]){
							if(x[i+1][j] && x[i+1][j+1]){
								cout << "A" << endl;
								flag = 1;
							}
							else if(j<6 && x[i+1][j+1] && x[i+1][j+1]){
								cout << "E" << endl;
								flag = 1;
							}
							else if(j>0 && x[i+1][j-1] && x[i+1][j]){
								cout << "G" << endl;
								flag = 1;
							}
						}
					}
					if(!flag && i<6){
						if(x[i+1][j]){
							if(j<7 && x[i+1][j+1] && x[i+2][j+1]){
								cout << "F" << endl;
								flag = 1;
							}
							else if(j>0 && x[i+1][j-1] && x[i+2][j-1]){
								cout << "D" << endl;
								flag = 1;
							}
							else if(i<5 && x[i+2][j] && x[i+3][j]){
								cout << "B" << endl;
								flag = 1;
							}
						}
					}
					if(flag){
						i=10;j=10;
					}
				}
			}
		}
	}
	return 0;
}

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

int main(){
	char ch[8][8];
	bool judged;
	
	while((scanf("%s", ch[0])) != EOF){
		for(int i = 1; i < 8; i++){
				scanf("%s", ch[i]);
		}
		
		judged = false;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(ch[i][j] == '1'){
					//A
					if(i + 1 < 8 && ch[i + 1][j] == '1' &&
					 j + 1 < 8 && ch[i][j + 1] == '1' &&
					 ch[i + 1][j + 1] == '1'){
						printf("A\n");
						judged = true;
						break;
					}
					//B
					if(i + 3 < 8 && ch[i + 1][j] == '1' &&
					 ch[i + 2][j] == '1' && ch[i + 3][j] == '1'){
						printf("B\n");
						judged = true;
						break;
					}
					//C
					if(j + 3 < 8 && ch[i][j + 1] == '1' &&
					 ch[i][j + 2] == '1' && ch[i][j + 3] == '1'){
						printf("C\n");
						judged = true;
						break;
					}
					//D
					if(i + 2 < 8 && j - 1 >= 0 &&
					 ch[i + 1][j - 1] == '1' && ch[i][j + 1] == '1' &&
					 ch[i + 2][j - 1] == '1'){
						printf("D\n");
						judged = true;
						break;
					}
					//E
					if(i + 1 < 8 && j + 2 < 8 &&
					 ch[i][j + 1] == '1' && ch[i + 1][j + 1] == '1' &&
					 ch[i + 1][j + 2] == '1'){
						printf("E\n");
						judged = true;
						break;
					}
					//F
					if(i + 2 < 8 && j + 1 < 8 &&
					 ch[i + 1][j] == '1' && ch[i + 1][j + 1] == '1' &&
					 ch[i + 2][j + 1] == '1'){
						printf("F\n");
						judged = true;
						break;
					}
					//G
					if(i + 1 < 8 && j + 1 < 8 && j - 1 >= 0 &&
					 ch[i + 1][j] == '1' && ch[i][j + 1] == '1' &&
					 ch[i + 1][j - 1] == '1'){
						printf("G\n");
						judged = true;
						break;
					}
				}
			}
			
			if(judged) break;
		}
	}
	
	return 0;
}

C++: #include<stdio.h>

int main()
{
	int a[8][8];
	while(scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[0][0],&a[0][1],&a[0][2],&a[0][3],&a[0][4],&a[0][5],&a[0][6],&a[0][7])!=EOF)
	{
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[1][0],&a[1][1],&a[1][2],&a[1][3],&a[1][4],&a[1][5],&a[1][6],&a[1][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[2][0],&a[2][1],&a[2][2],&a[2][3],&a[2][4],&a[2][5],&a[2][6],&a[2][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[3][0],&a[3][1],&a[3][2],&a[3][3],&a[3][4],&a[3][5],&a[3][6],&a[3][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[4][0],&a[4][1],&a[4][2],&a[4][3],&a[4][4],&a[4][5],&a[4][6],&a[4][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[5][0],&a[5][1],&a[5][2],&a[5][3],&a[5][4],&a[5][5],&a[5][6],&a[5][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[6][0],&a[6][1],&a[6][2],&a[6][3],&a[6][4],&a[6][5],&a[6][6],&a[6][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[7][0],&a[7][1],&a[7][2],&a[7][3],&a[7][4],&a[7][5],&a[7][6],&a[7][7]);
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(a[x][y]==1)
				{
					if(a[x][y+1]==1)
					{
						if(a[x+1][y]==1)
						{
							if(a[x+1][y+1])
							{						
								printf("A\n");
							}
							else if(a[x+1][y-1])
							{
								printf("G\n");
							}
						}
						else if(a[x][y+2]==1&&a[x][y+3]==1)
						{
							printf("C\n");
						}
						else if(a[x+1][y+1]==1&&a[x+1][y+2]==1)
						{
							printf("E\n");
						}
					}
					else if(a[x+1][y]==1)
					{
						if(a[x+2][y]==1&&a[x+3][y]==1)
						{
							printf("B\n");
						}
						else if(a[x+1][y-1]==1&&a[x+2][y-1]==1)
						{
							printf("D\n");
						}
						else if(a[x+1][y+1]==1&&a[x+2][y+1]==1)
						{
							printf("F\n");
						}
					}
					x=10;
					y=10;
				}
			}
		}
	}
}