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<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;
	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++){
		cin>>ss;
		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 <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

char mass[8][8];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i-1][j] == '1' && mass[i-1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;

        for (int i = 0; i < 8; i++) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}