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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[9];
	while(getline(cin, field1[0])){
			for(int i = 1;i < 8;i++){
				getline(cin, field1[i]);
			}
			cin.ignore();

		for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				if(field1[i][j] == '1') field[i][j] = 1;
				else field[i][j] = 0;
			}
		}
		/*for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				cout << field[i][j];
			}
			cout << endl;
		}
		cout << endl;*/
		for(int i = 0;i < 8;i++){
			int flag = 0;
			for(int j = 0;j < 8;j++){
				if(field[i][j] == 1){
					//cout << i << j <<endl;
					if(field[i][j] == field[i][j+1]){
						if(field[i][j] == field[i+1][j]){
							if(field[i][j] == field[i+1][j+1]){
								cout << "A" << endl;
								flag = 1;break;
							}
							else if(field[i][j] == field[i+1][j-1]){
								cout << "G" << endl;
								flag = 1;break;
							}
						}
						else if(field[i][j] == field[i][j+2] && field[i][j] == field[i][j+3]){
							cout << "C" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+1][j+2]){
							cout << "E" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j]){
						if(field[i][j] == field[i+1][j-1] && field[i][j] == field[i+2][j-1]){
							cout << "D" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+2][j+1]){
							cout << "F" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j] && field[i][j] == field[i+2][j] && field[i][j] == field[i+3][j]){
						cout << "B" << endl;
						flag = 1;break;
					}
				}
			}
			if(flag == 1) break;
		}
		
	}

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>

typedef long long ll;
using namespace std;

bool in(int i,int j){
	if(i >= 0 && i<8 && j>=0 && j<8) return true;
	return false;
}

bool is_A(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i+1,j) && table[i+1][j]==1
		&& in(i+1,j+1) && table[i+1][j+1]==1
		) return true;

	return false;
}

bool is_B(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i+1,j+1) && table[i+1][j]==1 
		&& in(i+2,j) && table[i+2][j]==1
		&& in(i+3,j+1) && table[i+3][j]==1
		) return true;

	return false;
}

bool is_C(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i,j+2) && table[i][j+2]==1
		&& in(i,j+3) && table[i][j+3]==1
		) return true;

	return false;
}

bool is_D(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i-1,j+1) && table[i-1][j+1]==1
		&& in(i+1,j) && table[i+1][j]==1
		) return true;

	return false;
}

bool is_E(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i+1,j+1) && table[i+1][j+1]==1
		&& in(i+1,j+2) && table[i+1][j+2]==1
		) return true;

	return false;
}

bool is_F(int i,int j,int table[8][8]){
	if(table[i][j]==1
		&& in(i+1,j) && table[i+1][j]==1 
		&& in(i+1,j+1) && table[i+1][j+1]==1
		&& in(i+2,j+1) && table[i+2][j+1]==1
		) return true;

	return false;
}

bool is_G(int i,int j,int table[8][8]){
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1
		&& in(i+1,j-1) && table[i+1][j-1]==1
		&& in(i+1,j) && table[i+1][j]==1 		
		) return true;

	return false;
}

int main()
{
	int table[8][8];
	

	while(1){
		bool is_eof = false;
		memset(table,0,sizeof(table));
		for(int i=0;i<8;i++){
			char buf[32];
			if(scanf("%s",buf)==EOF){
				is_eof = true;
				break;
			}
			for(int j=0;j<8;j++){
				table[i][j]=buf[j]-'0';
			}
		}
		
		if(is_eof) break;

		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(is_A(i,j,table)){
					cout << 'A' << endl;
					goto found;
				}
				else if(is_B(i,j,table)){
					cout << 'B' << endl;
					goto found;
				}
				else if(is_C(i,j,table)){
					cout << 'C' << endl;
					goto found;
				}
				else if(is_D(i,j,table)){
					cout << 'D' << endl;
					goto found;
				}
				else if(is_E(i,j,table)){
					cout << 'E' << endl;
					goto found;
				}
				else if(is_F(i,j,table)){
					cout << 'F' << endl;
					goto found;
				}
				else if(is_G(i,j,table)){
					cout << 'G' << endl;
					goto found;
				}
			}
		}
found:;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
string str[10]; 
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 	{cout << "G" << endl; }

}

int main(){
	
	while(1){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++)str[i][j]=0;
	}
	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);
	break;
	}

	
	}
	
}