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
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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 <string>
using namespace std;

#define SIZE 8

int main() {
	string source[SIZE];
	while (!cin.eof()) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		int map[14][14], x = SIZE, y = SIZE;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = source[i][j] == '1' ? 1 : 0;
				if (source[i][j] == '1' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] == 1) {
			if (map[y][x + 1] == 1 && map[y + 1][x] == 1) {
				cout << "A";
			} else if (map[y + 2][x + 1] == 1) {
				cout << "F";
			} else if (map[y + 1][x + 2] == 1) {
				cout << "E";
			}
		} else if (map[y - 1][x - 1] == 1) {
			if (map[y][x + 1] == 1) {
				cout << "G";
			} else if (map[y + 2][x - 1] == 1) {
				cout << "D";
			}
		} else if (map[y + 3][x]) {
			cout << "B";
		} else {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
char ta[12][12];
int main(){
while(cin>>ta[0][0]){
	int y,x;
	bool f=1;
	for(int i=0;i<8;i++){
		for(int j=(i==0);j<8;j++){
			char now;
			cin>>now;
			if(now=='1'&&f){y=i,x=j;f=0;}
			ta[i][j]=now;
		}
	}
	if(ta[y][x+1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x+1]=='1')cout<<"A";
	
	else if(ta[y+1][x]=='1'&&ta[y+2][x]=='1'&&ta[y+3][x]=='1')cout<<"B";
	
	else if(ta[y][x+1]=='1'&&ta[y][x+2]=='1'&&ta[y][x+3]=='1')cout<<"C";
	
	else if(ta[y][x+1]=='1'&&ta[y+1][x+1]=='1'&&ta[y+1][x+2]=='1')cout<<"E";
	
	else if(ta[y+1][x]=='1'&&ta[y+1][x+1]=='1'&&ta[y+2][x+1]=='1')cout<<"F";
	
	else if(ta[y+2][x-1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x-1]=='1')cout<<"D";
	else cout<<"G";
	cout<<endl;
		for(int i=0;i<12;i++)for(int j=0;j<12;j++)ta[i][j]='0';
}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int m[10][10]={0},a[5],k=0;

void dfs(int i,int j){
  if(m[i-1][j]==1){
    m[i-1][j]=0;
    a[k]=1;
    //cout<<"1"<<" ";////
    k++;
    dfs(i-1,j);
  }
  if(m[i][j-1]==1){
    //  cout<<"2"<<" ";////
    m[i][j-1]=0;
    a[k]=2;
    k++;
    dfs(i,j-1);
  }
  if(m[i+1][j]==1){
    //    cout<<"3"<<" ";////
    m[i+1][j]=0;
    a[k]=3;
    k++;
    dfs(i+1,j);  
  }
  if(m[i][j+1]==1){
    //    cout<<"4"<<" ";////
    m[i][j+1]=0;
    a[k]=4;
    k++;
    dfs(i,j+1); 
  }  
}

int main(){
  int ih=0,jh=0;
  char s;
  while(cin>>s){
    k=0;
    m[1][1]=s-'0';
    for(int i=1;i<=8;i++){
      for(int j=1;j<=8;j++){
	//cout<<i<<" "<<j<<endl;/////
	if(i==1&&j==1)continue;
	else cin>>s;
	m[i][j]=s-'0';
	
	if(m[i][j]==1){
	  ih=i;
	  jh=j;
	}
	
      }
    }
    m[ih][jh]=0;
    dfs( ih , jh );
    //cout<<endl<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;////
    if(a[0]==1&&a[1]==2&&a[2]==3)cout<<"A"<<endl;
    else if(a[0]==1&&a[1]==1&&a[2]==1)cout<<"B"<<endl;
    else if(a[0]==2&&a[1]==2&&a[2]==2)cout<<"C"<<endl;
    else if(a[0]==1&&a[1]==4&&a[2]==1)cout<<"D"<<endl;
    else if(a[0]==2&&a[1]==1&&a[2]==2)cout<<"E"<<endl;
    else if(a[0]==1&&a[1]==2&&a[2]==1)cout<<"F"<<endl;
    else if(a[0]==1&&a[1]==4&&a[2]==2)cout<<"G"<<endl;

  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
 
#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PI acos(-1.0)

using namespace std;

static const double EPS = 1e-9;
typedef pair<double, int> stn;
typedef long long ll;

string ptn[7] = {	"1100110000000000",
					"1000100010001000",
					"1111000000000000",
					"0100110010000000",
					"1100011000000000",
					"1000110001000000"
					"0110110000000000"};

int main(){
	
	while(1){
		char ans = 0;
		string str;
		vector<string> surf = vector<string>(16, "0000000000000000");
		
		for(int i = 0; i < 8; ++i){
		
			if(cin.eof())
				return 0;
			
			cin >> str;
			surf[i] = str+"0000";
			
		}
		
		for(int y = 0; y < 8; ++y){
			for(int x = 0; x < 8; ++x){
				
				if(surf[y][x] == '1'){
					for(int k = 0; k < 7; ++k){
						
						int cnt = 0;
						
						for(int i = 0; i < 16; ++i){
							if( ptn[k][i] == surf[y+i/4][x+i%4] )
								cnt++;
							else
								break;
						}
						
						if(cnt>=16){
							ans = char('A'+k);
							goto out;
						}
						
					}
				}
				
			}
		}
		
		out:
			if(ans)
				cout << ans << endl;
	}
}