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 <cstring>
using namespace std;
bool field[8][8];
int x, y;

char solve(){
  if(field[y][x+1] && field[y+1][x] && field[y+1][x+1]) return 'A';
  if(field[y+1][x] && field[y+2][x] && field[y+3][x]) return 'B';
  if(field[y][x+1] && field[y][x+2] && field[y][x+3]) return 'C';
  if(field[y+1][x] && field[y+1][x-1] && field[y+2][x-1]) return 'D';
  if(field[y][x+1] && field[y+1][x+1] && field[y+1][x+2]) return 'E';
  if(field[y+1][x] && field[y+1][x+1] && field[y+2][x+1]) return 'F';
  if(field[y][x+1] && field[y+1][x-1] && field[y+1][x]) return 'G';
}


int main(){
  char ans;
  string tmp[8];
  
  while(cin >> tmp[0] >> tmp[1] >> tmp[2] >> tmp[3] >> tmp[4] >> tmp[5]
	>> tmp[6] >> tmp[7]){
    bool flag = 0;
    
    for(int i = 0 ; i < 8 ; i++){
      for(int j = 0 ; j < 8 ; j++){
	field[i][j] = tmp[i][j] - '0';
      }
    }
    
    for(y = 0 ; y < 8 ; y++){
      for(x = 0 ; x < 8 ; x++){
	if(field[y][x] && !flag){
	  cout << solve();
	  flag = 1;
	}
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
string s[8];
void f(){
	char b='A';
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]=='1'){
				if(i<5)if(s[i+3][j]=='1')b='B';
				if(j<5)if(s[i][j+3]=='1')b='C';
				if(i<6&&j>0)if(s[i+2][j-1]=='1')b='D';
				if(i<7&&j<6)if(s[i+1][j+2]=='1')b='E';
				if(i<6&&j<7)if(s[i+2][j+1]=='1')b='F';
				if(i<7&&j>0)if(s[i+1][j-1]=='1')b='G';
				cout<<b<<endl;
				return;
			}
		}
	}
}

int main(){
	while(cin>>s[0]){
		for(int i=1;i<8;i++)cin>>s[i];
		f();
	}
	return 0;
}

C++: #include <iostream>
int main(){
	std::string s[8];
	int f = 0, e = 0;
	while(1){
		if(f)std::cout << "\n";
		else f = 1;

		int x = 0,y = 0;
		for(int i=0;i<8;i++){
			std::cin >> s[i];
			if(std::cin.eof())e=1;
		}

		if(e)return 0;
		
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++)
				if(s[i][j] == '1' && !x && !y)x=j,y=i;
		}

		char res;
		if(y+1 < 8 && s[y+1][x] == '1'){
			if(x-1 >= 0 && s[y+1][x-1] == '1'){
				if(x+1 < 8 && s[y][x+1] == '1'){
					res = 'G';
				}
				else{
					res = 'D';
				}
			}
			else if(x+1 < 8 && s[y+1][x+1] == '1'){
				if(s[y][x+1] == '1'){
					res = 'A';
				}
				else{
					res = 'F';
				}
			}
			else{
				res = 'B';
			}
		}
		else{
			if(x+1 < 8 && s[y+1][x+1] == '1'){
				res = 'E';
			}
			else{
			res = 'C';
			}
		}

		std::cout << res << std::endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int kaizyo(int x){
    if(x==1)return x;
    else return x*kaizyo(x-1);
}


int main() {
    vector<vector<char>> v(8,vector<char>(8));
    while(cin>>v[0][0]){
        rep(i,1,8)cin>>v[0][i];
    rep(i,1,8)rep(j,0,8)cin>>v[i][j];
    rep(i,0,8){
        rep(j,0,8){
            if(v[i][j]=='1'){
                //cout<<9<<endl;
                if(v[i][j+1]=='1'&&v[i+1][j]=='1'&&v[i+1][j+1]=='1'){cout<<"A"<<endl;goto AWAY;}
                if(v[i+1][j]=='1'&&v[i+1][j-1]=='1'&&v[i+2][j-1]=='1'){cout<<"D"<<endl;goto AWAY;}
                if(v[i][j+1]=='1'&&v[i+1][j+2]=='1'&&v[i+1][j+1]=='1'){cout<<"E"<<endl;goto AWAY;}
                if(v[i][j+1]=='1'&&v[i+2][j+1]=='1'&&v[i+1][j+1]=='1'){cout<<"F"<<endl;goto AWAY;}
                if(v[i][j+1]=='1'&&v[i+1][j]=='1'&&v[i+1][j-1]=='1'){cout<<"G"<<endl;goto AWAY;}
                if(v[i+3][j]=='1'){cout<<"B"<<endl;goto AWAY;}
                if(v[i][j+3]=='1'){cout<<"C"<<endl;goto AWAY;}
            }
        }
    }
    AWAY:;
    }
    return 0;
}

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

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

char t[10][10];
int w = 8;
int h = 8;

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

int check(int y,int x,int kind){
  for(int i=0;i<4;i++){
    int nx = x + dx[kind][i];
    int ny = y + dy[kind][i];
    if(nx>=0 && nx<w && ny>=0 && ny<h){
        if(t[ny][nx] != '1'){
          return false;
        }
    }
  }
    return true;
}

void solve(){
  rep(i,h){
    rep(j,w){
      rep(k,7){
        int tmp = check(i,j,k);
        if(tmp){
          cout<<(char)('A'+k)<<endl;
          return;
        }
      }
    }
  }
}

int main(){
  while(1){
    rep(i,h){
      if(!(cin>>t[i])) return 0;
    }
    solve();
  }
}