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>

using namespace std;

int main()
{
	char ret;
	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;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
  char field[8][8];

  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      cin >> field[i][j];
    }
  }
  
  bool judge = false;
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      if (field[i][j] == '1'){
        if (field[i + 3][j] == '1'){
          cout << 'B';
        }
        else if (field[i][j + 3] == '1'){
          cout << 'C';
        }
        else if (field[i + 2][j - 1] == '1'){
          cout << 'D';
        }
        else if (field[i + 1][j + 2] == '1'){
          cout << 'E';
        }
        else if (field[i + 2][j + 1] == '1'){
          cout << 'F';
        }
        else if (field[i + 1][j - 1] == '1'){
          cout << 'G';
        }
        else {
          cout << 'A';
        }
        judge = true;
      }
      if (judge)  break;
    }
    if (judge)  break;
  }
  cout << endl;
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int dx[7][4]={{0,0,1,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,-1,0,1}};
int dy[7][4]={{0,1,1,0},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,1,1,0}};
string MAP[8];
string ans="ABCDEFG";

int main(){
	while(1){
	for(int i=0; i<8; ++i){
		cin >> MAP[i];
		if(!cin.eof()){
			return 0;
		}
	}
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			if(MAP[i][j]=='1'){
				for(int k=0; k<7; ++k){
					bool ok=true;
					for(int l=0; l<4; ++l){
						int nx=j+dx[k][l];
						int ny=i+dy[k][l];
						if((0<=nx&&nx<8&&0<=ny&&ny<8&&MAP[ny][nx]!='1')||(nx<0||8<=nx||ny<0||8<=ny)){
							ok=false;
							break;
						}
					}
					if(ok){
						cout << ans[k] << "\n";
						break;
					}
				}
			}
		}
	}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

int main(){
	int fig[8];
	while(cin>>fig[0]){
		for(int i=1;i<8;i++) cin>>fig[i];
		for(int i=0;i<8;i++){
			if(fig[i]!=0){
				if(fig[i]==fig[i+1]&&fig[i]%11==0)
				printf("A\n");
				else if(fig[i]==fig[i+1]&&fig[i]==fig[i+2])
				printf("B\n");
				else if(fig[i]%1111==0)
				printf("C\n");
				else if(fig[i+1]==fig[i]*10+fig[i])
				printf("D\n");
				else if(fig[i+1]==fig[i]/10)
				printf("E\n");
				else if(fig[i+1]==fig[i]+fig[i]/10)
				printf("F\n");
				else if(fig[i+1]==fig[i]*10)
				printf("G\n");
				break;
			}
		}
	}
}

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

int main(){
    char mas[8][8];
    while(1){
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                cin >> mas[i][j];
            }
        }
        if(cin.eof()) break;
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(mas[i][j] == '1'){
                    if(mas[i+1][j]=='1'&&mas[i][j+1]=='1'&&mas[i+1][j+1]=='1') cout << "A" << endl;
                    else if(mas[i+1][j]=='1'&&mas[i+2][j]=='1'&&mas[i+3][j]=='1') cout << "B" << endl;
                    else if(mas[i][j+1]=='1'&&mas[i][j+2]=='1'&&mas[i][j+3]=='1') cout << "C" << endl;
                    else if(mas[i+1][j]=='1'&&mas[i+1][j-1]=='1'&&mas[i+2][j-1]=='1') cout << "D" << endl;
                    else if(mas[i][j+1]=='1'&&mas[i+1][j+1]=='1'&&mas[i+1][j+2]=='1') cout << "E" << endl;
                    else if(mas[i+1][j]=='1'&&mas[i+1][j+1]=='1'&&mas[i+2][j+1]=='1') cout << "F" << endl;
                    else if(mas[i][j+1]=='1'&&mas[i+1][j]=='1'&&mas[i-1][j-1]=='1') cout << "G" << endl;
                }
            }
        }
    }
}

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 (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else if (v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i - 1][j - 1] == '1')ans = 'G';
					break;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}