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(), "")
		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>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	bool f=0;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	double yy1=(y2-y1),yy2=y4-y3;
	if(yy1==0)yy1=0.0000001;
	if(yy2==0)yy2=0.0000001;
	double r1=(x2-x1) / (y2-y1);
	double r2=(x4-x3) / (y4-y3);
	if(abs(r1-r2 ) <=0.000001  )f=1;
	if(f)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	}
	return 0;
}*/

/*#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[50][50];
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
char a[]={'R','D','L','U'};
vector<char>ans;
void dfs(int y,int x,char now){
	bool f=1;
	for(int i=0;i<4;i++){
		if(a[i]==now&&ta[y+dy[i]][x+dx[i]]=='1'){
			ans.push_back(a[i]);
			f=1;
			dfs(y+dy[i],x+dx[i],now);
		}
	}
	if(f){
		for(int i=0;i<4;i++){
			if(ta[y+dy[i]][x+dx[i]]=='1'){
				ans.push_back(a[i]);
				dfs(y+dy[i],x+dx[i],a[i]);
			}
		}
	}
}

int main(){


	for(int i=0;i<9;i++){
		for(int j=0;j<4;j++){
			char now;
			cin>>now;
			ta[i][j]=now;
		}
	}
		dfs(0,0,'F');
		for(int i=0;i<ans.size();i++)cout<<ans[i];
		ans.clear();
	return 0;
}*/


#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];

bool ok(int y,int x){
	if(y<0||x<0||y>7||x>7)return 0;
	if(ta[y][x]=='1')return 1;
	return 0;
}
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'){
			y=i,x=j;
	if( ok(y,x+1)&ok(y+1,x)&&ok(y+1,x+1) ){cout<<"A";f=0;}
	
	else if( ok(y+1,x)&&ok(y+2,x)&&ok(y+3,x) ){cout<<"B";f=0;}
	
	else if( ok(y,x+1)&&ok(y,x+2)&&ok(y,x+3) ){cout<<"C";f=0;}
	
	else if( ok(y+2,x-1)&&ok(y+1,x-1)&&ok(y+1,x)){cout<<"C";f=0;}
	
	else if( ok(y,x+1)&ok(y+1,x+1)&&ok(y+1,x+2) ){cout<<"E";f=0;}
	
	else if( ok(y+1,x)&&ok(y+1,x+1) &&ok(y+2,x+1)){cout<<"F";f=0;}
	
	else if( ok(y,x+1)&&ok(y+1,x)&&ok(y+1,x-1) ){cout<<"G";f=0;}
	
	if(f==0){cout<<endl;goto end;}
			}
			ta[i][j]=now;
		}
	}
	end:;
		for(int i=0;i<8;i++)for(int j=0;j<8;j++)ta[i][j]='0';
}
	
	return 0;
}

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

char n[12][12];
char figure[7][4][5] = {
	{"1100","1100","0000","0000"},
	{"1000","1000","1000","1000"},
	{"1111","0000","0000","0000"},
	{"0100","1100","1000","0000"},
	{"1100","0110","0000","0000"},
	{"1000","1100","0100","0000"},
	{"0110","1100","0000","0000"}
};


void clear(){
	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
}

int main(){
	clear();
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){

		for(int i=0; i<7; i++){
			for(int j=0; j<8; j++){
				for(int k=0; k<8; k++){
					bool flag=true;
					
					for(int x=0; x<4; x++){
						for(int y=0; y<4; y++){
							if(figure[i][x][y] != n[j+x][k+y]) flag = false;
						}
					}
					
					if(flag){
						cout << (char)('A'+i) << endl;
					}

				}
			}
		}
		clear();
	}
	return 0;
}

C++: #include <iostream>

#define limit(A,X,C) ((X<A)?A:(C<X)?C:X)

char map[8+1][8]={'0'};

int pget(int x,int y)
{
	if(limit(0,x,7)==x && limit(0,y,7)==y)
		return map[y][x]-'0';
	return 0;
}

char check(int x, int y)
{
	std::cout << ":" << x << y << std::endl;
	if(pget(x+1,y))
	{
		if(pget(x+2,y))
			return 'C';
		if(!pget(x,y+1))
			return 'E';
		if(pget(x+1,y+1))
			return 'A';
		return 'G';
	}
	if(pget(x,y+2))
		return 'B';
	if(pget(x+1,y+2))
		return 'F';
	return 'D';
}

int main(void)
{
	do
	{
		for(int i=0; i<8; i++)
			if(!(std::cin >> map[i]))
				return 0;
		int x,y;
		bool end=false;
		for(y=0; y<8; y++)
		{
			for(x=0; x<8; x++)
				if(map[y][x] == '1')
				{
					end=true;
					break;
				}
			if(end)
				break;
		}

		std::cout << check(x,y) << std::endl;
	}while(std::cin.getline(map[0],sizeof(map[0])));
	
	return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

char ret;

int main()
{

	while(!cin.eof()){
	string s;
	
	for(int i=0;i<8;i++){
		string s_tmp;
		cin >>s_tmp;
		s += s_tmp;
	}
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	
	cout<<ret<<endl;
	}
	return 0;
}