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)
		fmt.Scanln()
	}
}

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];
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;
		}
	}
	//for(int i=0;i<8;i++){for(int j=0;j<8;j++){cout<<ta[i][j];}cout<<endl;}
	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][x+1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x-1]=='1')cout<<"G";
	
	else if(ta[y+2][x-1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x-1]=='1')cout<<"D";

	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 img[8][8];

int checker(int i, int j) {
  if (0 <= i && i < 8 && 0 <= j && j < 8) {
    return img[i][j];
  } else {
    return 0;
  }
}

int main() {
  while (!cin.eof()) {
    for (int i = 0; i < 8; i++) {
      for (int j = 0; j < 8; j++) {
        if (cin.eof()) return 0;
        char c;
        cin >> c;
        img[i][j] = c - '0';
      }
    }
    bool flag = false;
    for (int i = 0; i < 8; i++) {
      for (int j = 0; j < 8; j++) {
        if (checker(i, j)) {
          if (checker(i,j+1) && checker(i+1,j) && checker(i+1,j+1)) {
            cout << 'A' << endl;
          } else if (checker(i+1,j) && checker(i+2,j) && checker(i+3,j)) {
            cout << 'B' << endl;
          } else if (checker(i,j+1) && checker(i,j+2) && checker(i,j+3)) {
            cout << 'C' << endl;
          } else if (checker(i+1,j) && checker(i+1,j-1) && checker(i+2,j-1)) {
            cout << 'D' << endl;
          } else if (checker(i,j+1) && checker(i+1,j+1) && checker(i+1,j+2)) {
            cout << 'E' << endl;
          } else if (checker(i+1,j) && checker(i+1,j+1) && checker(i+2,j+1)) {
            cout << 'F' << endl;
          } else if (checker(i,j+1) && checker(i+1,j) && checker(i+1,j-1)) {
            cout << 'G' << endl;
          } 
          flag = true;
          break;
        }
      }
      if (flag) break;
    }
  }


  return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;
struct P {int x, y; char s[4][5];};
char f[8][9] = {{""}};
bool c(int x, int y, P p)
{
	int i, j;
	char t[8][9];
	for (i = 0; i < 8; i++)
		strcpy(t[i], f[i]);
	for (i = 0; i < p.y; i++)
	{
		for (j = 0; j < p.x; j++)
		{
			t[y+i][x+j] = p.s[i][j];
		}
	}
	for (i = 0; i < 8; i++)
		if (strcmp(t[i], f[i]) != 0)
		{
			return false;
		}
	return true;
}
int main()
{
	P p[7] = {2, 2, {"11", "11"},
		1, 4, {"1", "1", "1", "1"},
		4, 1, {"1111"},
		2, 3, {"01", "11", "10"},
		3, 2, {"110", "011"},
		2, 3, {"10", "11", "01"},
		3, 2, {"011", "110"}};
	int i, j, k;
	bool b;
	char res;
	while (!cin.eof())
	{
		for (i = 0; i < 8; i++)
			cin >> f[i];
		getc(stdin);
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 8; j++)
			{
				for (k = 0; k < 7; k++)
				{
					if (8-j >= p[k].x && 8-i >= p[k].y)
						if (b = c(j, i, p[k]))
							res = 'A' + k;
				}
			}
		}
		cout << res << endl;
	}
}