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<cstdio>
#include<cstdlib>
#include<string>
using namespace std;

int dt[24][24];

int num=0;

bool checkA(int i,int j){
	if(dt[i+1][j]==1 && dt[i][j+1]==1 && dt[i+1][j+1]==1 && dt[i][j]==1)return true;
	else if(dt[i][j-1]==1 && dt[i+1][j-1]==1 && dt[i+1][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-1][j]==1 && dt[i-1][j+1]==1 && dt[i][j+1]==1 && dt[i][j]==1)return true;
	else if(dt[i-1][j-1]==1 && dt[i][j-1]==1 && dt[i-1][j]==1 && dt[i][j]==1)return true;
	else return false;
}

bool checkB(int  i,int j){
	if(dt[i+1][j]==1 && dt[i+2][j]==1 && dt[i+3][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-1][j]==1 && dt[i+1][j]==1 && dt[i+2][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-2][j]==1 && dt[i-1][j]==1 && dt[i+1][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-3][j]==1 && dt[i-2][j]==1 && dt[i-1][j]==1 && dt[i][j]==1)return true;
	else return false;
}

bool checkC(int i,int j){
	if(dt[i][j]==1){
		if(dt[i][j+1]==1 && dt[i][j+2]==1 && dt[i][j+3]==1)return true;
		else if(dt[i][j-1]==1 && dt[i][j+1]==1 && dt[i][j+2]==1)return true;
		else if(dt[i][j-2]==1 && dt[i][j-1]==1 && dt[i][j+1]==1)return true;
		else if(dt[i][j-3]==1 && dt[i][j-2]==1 && dt[i][j-1]==1)return true;
		else return false;
	}else return false;
}

bool checkD(int i,int j){
	if(dt[i][j]==1){
		if(dt[i+1][j]==1 && dt[i+1][j-1]==1 && dt[i+2][j-1]==1)return true;
		else if(dt[i-1][j]==1 && dt[i][j-1]==1 && dt[i+1][j-1]==1)return true;
		else if(dt[i][j+1]==1 && dt[i-1][j+1]==1 && dt[i+1][j]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j+1]==1 && dt[i-2][j+1]==1)return true;
		else return false;
	}else return false;
}

bool checkE(int i,int j){
	if(dt[i][j]==1){
		if(dt[i][j+1]==1 && dt[i+1][j+1]==1 && dt[i+1][j+2]==1)return true;
		else if(dt[i][j-1]==1 && dt[i+1][j]==1 && dt[i+1][j+1]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j-1]==1 && dt[i][j+1]==1)return true;
		else if(dt[i][j-1]==1 && dt[i-1][j-1]==1 && dt[i-1][j-2]==1)return true;
		else return false;
	}else return false;
}

bool checkF(int i,int j){
	if(dt[i][j]==1){
		if(dt[i+1][j]==1 && dt[i+1][j+1]==1 && dt[i+2][j+1]==1)return true;
		else if(dt[i-1][j]==1 && dt[i][j+1]==1 && dt[i+1][j+1]==1)return true;
		else if(dt[i][j-1]==1 && dt[i-1][j-1]==1 && dt[i+1][j]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j-1]==1 && dt[i-2][j-1]==1)return true;
		else return false;
	}else return false;
}

bool checkG(int i,int j){
	if(dt[i][j]==1){
		if(dt[i][j+1]==1 && dt[i+1][j]==1 && dt[i+1][j-1]==1)return true;
		else if(dt[i][j-1]==1 && dt[i+1][j-1]==1 && dt[i+1][j-2]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j+1]==1 && dt[i][j-1]==1)return true;
		else if(dt[i][j+1]==1 && dt[i-1][j+1]==1 && dt[i-1][j+2]==1)return true;
		else return false;
	}else return false;
}

int main(){
	string ss;
	while(1){
		for(int i=0;i<24;i++){
			for(int j=0;j<24;j++){
				dt[i][j]=0;
			}
		}
		for(int i=8;i<16;i++){
			if(cin>>ss)return 0;
			for(int j=8;j<16;j++){
				dt[i][j]=ss[j-8]-'0';
			}
		}
		for(int a=8;a<16;a++){
			for(int b=8;b<16;b++){
				if(!num){
					if(checkA(a,b)){cout<<"A"<<endl;num++;}
					else if(checkB(a,b)){cout<<"B"<<endl;num++;}
					else if(checkC(a,b)){cout<<"C"<<endl;num++;}
					else if(checkD(a,b)){cout<<"D"<<endl;num++;}
					else if(checkE(a,b)){cout<<"E"<<endl;num++;}
					else if(checkF(a,b)){cout<<"F"<<endl;num++;}
					else if(checkG(a,b)){cout<<"G"<<endl;num++;}
				}
			}
		}
	}
	return 0;
}

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

int main(){
	char f[9][9];
	while(1){
		bool flag=false;
		
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				if( scanf(" %c", &f[i][j])==EOF){
					flag=true;
					break;
				}
			} 
			if(flag) break;	
		}
		if(flag) break;

		bool ans=false;
		char c='1';
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				
				if(f[j][i]==c){
					if(i<=6 && j<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j+1][i+1]==c){
						printf("A\n");	
						ans=true;
						break;
					}
					else if(j<=4 && f[j+1][i]==c && f[j+2][i]==c && f[j+3][i]==c){
						printf("B\n");	
						ans=true;
						break;
					}
					else if(i<=4 && f[j][i+1]==c && f[j][i+2]==c && f[j][i+3]==c){
						printf("C\n");	
						ans=true;
						break;
					}
					else if(1<=j && j<=6 && i<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j-1][i+1]==c){
						printf("D\n");	
						ans=true;
						break;
					}
					else if(j<=5 && i<=6 && f[j][i+1]==c && f[j+1][i+1]==c && f[j+1][i+2]==c){
						printf("E\n");	
						ans=true;
						break;
					}
					else if(j<=5 && i<=6 && f[j+1][i]==c && f[j+1][i+1]==c && f[j+2][i+1]==c){
						printf("F\n");	
						ans=true;
						break;
					}
					else if(1<=j && i<=5 && f[j][i+1]==c && f[j-1][i+1]==c && f[j-1][i+2]==c){
						printf("G\n");	
						ans=true;
						break;
					}
											
				}
	
			}
			if(ans) break;
		}
			
	}
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<string> s(8);
        for(int i=0; i<8; ++i){
            if(!(cin >> s[i]))
                return 0;
        }

        int dy[] = {3, 0, 2, 1, 2, 1};
        int dx[] = {0, 3, -1, 2, 1, -2};

        bool ok = false;
        for(int i=0; i<8; ++i){
            for(int j=0; j<8; ++j){
                if(ok || s[i][j] == '0')
                    continue;
                for(int k=0; k<6; ++k){
                    if(i+dy[k] < 8 && 0 <= j+dx[k] && j+dx[k] < 8 && s[i+dy[k]][j+dx[k]] == '1'){
                        cout << (char)('B' + k) << endl;
                        ok = true;
                        break;
                    }
                }
                if(!ok){
                    cout << 'A' << endl;
                    ok = true;
                }
            }
        }
    }
}