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 <iomanip>
#include <string>
#include <algorithm>
#include <typeinfo>
using namespace std;

int main(){
    int zero = '0';
    int cnt = 0;
    string load[4];
    int j=0, i=0;
    bool end = false;
    while(1){
        cnt=0;
        for(i=0;i<8;i++){
            cin >>load[0];
            if(cin.eof()){
                end = true;
                break;
            }
            cnt ++;
            int k=0;
            for(int l=0;l<8;l++){
                k += load[0][l]-zero;
            }
            if (k>0){
                break;
            }
        }
        if(end){break;}
        for(j=1;(j+i<7)&&(j<4);j++){
            cin >>load[j];
            cnt ++;
            if(j+i==7){cnt=10;}
        }
        int trash=0;
        while((cin>>trash)&&(cnt<7)){cnt ++;}
        int index=0;
        for(i=0;i<8;i++){
            if(load[0][i]=='1'){
                index = i;
                break;
            }
        }
        string out = "poo";
        if(index<=6){
            if(load[0][index+1]=='1'){
                if((index<=4)&&(load[0][index+2])=='1'){
                    out = "C";
                }
                else if(i<=6){
                    if(load[1][index]=='1'){
                        if(load[1][index+1]=='1'){
                            out = "A";
                        }
                        else{out="G";}
                    }
                    else if(load[1][index+1]){
                        out ="E";
                    }
                }
            }
            else if(load[1][index]=='1'){
                if((j>=2)&&(load[2][index]=='1')){
                    out = "B";
                }
                else if(load[1][index+1]=='1'){
                    out = "F";
                }
                else{
                    out = "D";
                }
            }
        }
        else{
            if(load[1][index-1]=='1'){
                out = "D";
            }
            else{
                out = "B";
            }
        }
        cout <<out <<endl;
    }
    return 0;

}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
#define REPS(a,i,n) for(int i = a ; i < n ; ++i)
using namespace std;

int tile[20][20];


int main(){

	while (true){
		string a;
		if (cin.eof())
			break;
		/*
		for (size_t c = a.find_first_of(" "); c != string::npos;  c = a.find_first_of(" ")){
			a.erase(c, 1);
		}
		*/
		getline(cin, a);
		if (a.empty())continue;
		REP(j, 8){
			tile[3][7+3 - j] = '0' - a[7-j];
		}
		REP(i, 7){
			getline(cin,a); 
			/*for (size_t c = a.find_first_of(" "); c != string::npos; c = a.find_first_of(" ")){
				a.erase(c, 1);
			}*/

			REP(j, 8){
				tile[i+3 + 1][7+3 - j] = '0' - a[7-j];
			}
		}
		REP(i, 15){
			REP(j, 15){
				if (tile[i][j]){
					if (tile[i + 1][j] && tile[i][j + 1] && tile[i + 1][j + 1]){
						cout << "A" << endl;
						goto END;
					}
					if (tile[i][j+1] && tile[i+1][j + 1] && tile[i + 1][j + 2]){
						cout << "E" << endl;
						goto END;
					}
					if (tile[i+1][j] && tile[i+1][j + 1] && tile[i + 2][j + 1]){
						cout << "F" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i][j + 1] && tile[i + 1][j - 1]){
						cout << "G" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i+2][j] && tile[i + 3][j]){
						cout << "B" << endl;
						goto END;
					}
					if (tile[i][j+1] && tile[i][j + 2] && tile[i][j + 3]){
						cout << "C" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i+1][j - 1] && tile[i + 2][j - 1]){
						cout << "A" << endl;
						goto END;
					}
				}
			}
		}
	END:;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
string match(const vector<string> v){
	const string PTN[7][4]{
		{"11","11"},
		{"1","1","1","1"},
		{"1111"},
		{"01","11","10"},
		{"110","011"},
		{"10","11","01"},
		{"011","110"}
	};
	const int PTN_H[7]{2,4,1,3,2,3,2};
	const string PTN_NAME[7]={"A","B","C","D","E","F","G"};
	int ans=-1;
	for(int k=0;k<7;++k){
		int pw=PTN[k][0].size(),ph=PTN_H[k];
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				if(i+ph<8&&j+pw<8){
					bool f=true;
					for(int l=0;l<ph;++l){
						if(PTN[k][l]!=v[i+l].substr(j,pw))f=false;
					}
					if(f){ans=k;break;break;break;}
				}else{
					break;
				}
			}
		}
	}
	return PTN_NAME[ans];
}
int main(){
	for(;;){
		vector<string> surface;
		for(int i=0;i<8;++i){
			string s;
			getline(cin,s);
			if(s.empty())return 0;
			surface.push_back(s);
		}
		string ans = match(surface);
		cout<<ans<<endl;
		cin.ignore();
	}
	return 0;
}