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++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (cin >> s) {
		vector<string>v;
		v.push_back(s);
		rep(i, 0, 7) {
			string t; cin >> t;
			v.push_back(t);
		}
		char ans;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (v[i][j] == '1') {
					if (j + 1 < 8 && i + 1 < 8 && v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (i + 3 < 8 && v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (j + 3 < 8 && v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (i + 1 < 8 && j + 2 < 8 && v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (i + 2 < 8 && j + 1 < 8 && v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (i + 2 < 8 && j - 1 >= 0 && v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else if (j - 1 >= 0 && j + 1 < 8 && i + 1 < 8 && v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1')ans = 'G';
					goto here;
				}
			}
		}
	here:;
		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  while(cin >>s){
    int field[30][30]={0};
    for(int i=0; i<8; i++){
      if(i!=0) cin >>s;
      for(int j=0; j<8; j++) if(s[j] == '1') field[10+j][10+i] = 1;
    }
    for(int i=0; i<30; i++){
      for(int j=0; j<30; j++){
	if(field[j][i] == 1){
	  if(field[j+1][i] == 1 && field[j][i+1] == 1 && field[j+1][i+1] == 1) cout <<"A"<<endl;
	  if(field[j][i+1] == 1 && field[j][i+2] == 1 && field[j][i+3] == 1) cout <<"B"<<endl;
	  if(field[j+1][i] == 1 && field[j+2][i] == 1 && field[j+3][i] == 1) cout <<"C"<<endl;
	  if(field[j][i+1] == 1 && field[j-1][i+1] == 1 && field[j-1][i+2] == 1) cout <<"D"<<endl;
	  if(field[j+1][i] == 1 && field[j+1][i+1] == 1 && field[j+2][i+1] == 1) cout <<"E"<<endl;
	  if(field[j][i+1] == 1 && field[j+1][i+1] == 1 && field[j+1][i+2] == 1) cout <<"F"<<endl;
	  if(field[j+1][i] == 1 && field[j][i+1] == 1 && field[j-1][i+1] == 1) cout <<"G"<<endl;
	  break;
	}
      }
    }
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>

typedef long long ll;
using namespace std;

bool in(int i,int j){
	if(i >= 0 && i<8 && j>=0 && j<8) return true;
	return false;
}

bool is_A(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i+1,j) && table[i+1][j]==1
		&& in(i+1,j+1) && table[i+1][j+1]==1
		) return true;

	return false;
}

bool is_B(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i+1,j) && table[i+1][j]==1 
		&& in(i+2,j) && table[i+2][j]==1
		&& in(i+3,j) && table[i+3][j]==1
		) return true;

	return false;
}

bool is_C(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i,j+2) && table[i][j+2]==1
		&& in(i,j+3) && table[i][j+3]==1
		) return true;

	return false;
}

bool is_D(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i-1,j+1) && table[i-1][j+1]==1
		&& in(i+1,j) && table[i+1][j]==1
		) return true;

	return false;
}

bool is_E(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i+1,j+1) && table[i+1][j+1]==1
		&& in(i+1,j+2) && table[i+1][j+2]==1
		) return true;

	return false;
}

bool is_F(int i,int j,int table[8][8]){
	if(table[i][j]==1
		&& in(i+1,j) && table[i+1][j]==1 
		&& in(i+1,j+1) && table[i+1][j+1]==1
		&& in(i+2,j+1) && table[i+2][j+1]==1
		) return true;

	return false;
}

bool is_G(int i,int j,int table[8][8]){
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1
		&& in(i+1,j-1) && table[i+1][j-1]==1
		&& in(i+1,j) && table[i+1][j]==1 		
		) return true;

	return false;
}

int main()
{
	int table[8][8];
	

	while(1){
		bool is_eof = false;
		memset(table,0,sizeof(table));
		for(int i=0;i<8;i++){
			char buf[32];
			if(scanf("%s",buf)==EOF){
				is_eof = true;
				break;
			}
			for(int j=0;j<8;j++){
				table[i][j]=buf[j]-'0';
			}
		}
		
		if(is_eof) break;

		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(is_A(i,j,table)){
					cout << 'A' << endl;
					goto found;
				}
				else if(is_B(i,j,table)){
					cout << 'B' << endl;
					goto found;
				}
				else if(is_C(i,j,table)){
					cout << 'C' << endl;
					goto found;
				}
				else if(is_D(i,j,table)){
					cout << 'D' << endl;
					goto found;
				}
				else if(is_E(i,j,table)){
					cout << 'E' << endl;
					goto found;
				}
				else if(is_F(i,j,table)){
					cout << 'F' << endl;
					goto found;
				}
				else if(is_G(i,j,table)){
					cout << 'G' << endl;
					goto found;
				}
			}
		}
found:;
	}
}