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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<string> split_naive(const string &s, char delim) {
	vector<string> elems;
	string item;
	for(char ch:s){
		if(ch==delim){
			if(!item.empty()) elems.push_back(item);
			item.clear();
		}
		else{
			item += ch;
		}
	}
	if(!item.empty()) elems.push_back(item);
	return elems;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	while(true){
		vector<vector<int>> T(8,vector<int>(8));
		int LX=10,RX=-1,TY=10,BY=-1;
		REP(i,8){
			string S;
			if(!(cin>>S)){
				return 0;
			}
			REP(j,8){
				T[i][j] = S[j]-'0';
				if(T[i][j]){
					LX = min(LX,j);
					RX = max(RX,j);
					TY = min(TY,i);
					BY = max(BY,i);
				}
			}
		}
		if(RX-LX==1 && BY-TY==1){
			out('A');
		}
		else if(RX-LX==0 && BY-TY==3){
			out('B');
		}
		else if(RX-LX==3 && BY-TY==0){
			out('C');
		}
		else if(RX-LX==1 && BY-TY==2){
			if(T[TY][LX]) out('F');
			else out('D');
		}
		else{
			if(T[TY][LX]) out('E');
			else out('G');
		}
	}
	
	return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>
#include <set>
#include <numeric>

using namespace std;

typedef complex<double> P;
double sq(double x){return x*x;}

double cross(P x,P y){
	return x.real() * y.imag() - x.imag() * y.real();
}

char s[8][9];

char solve()
{
	
	vector<pair<int,int> > mino;
	for (int i = 0; i < 8; i++)
		for (int j = 0; j < 8; j++)
			if(s[i][j] == '1') mino.push_back(pair<int,int>(i,j));

	int hsum = 0,wsum = 0;
	for (int i = 1; i < 4; i++)
	{
		hsum += mino[i].first - mino[0].first;
		wsum += mino[i].second - mino[0].second;
	}
	if(hsum ==2 && wsum == 2) return 'A';
	else if(hsum == 6 && wsum == 0) return 'B';
	else if(hsum == 0 && wsum == 6) return 'C';
	else if(hsum == 4 && wsum == -2) return 'D';
	else if(hsum == 2 && wsum == 4) return 'E';
	else if(hsum == 4 && wsum == 2) return 'F';
	else return 'G';

}

int main(){
	while(true){
		for (int i = 0; i < 8; i++)
			if(!(cin>>s[i])) return 0;

		char ans = solve();
		printf("%c\n",ans);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[8];
	
	while(cin >> field1[0]){
		for(int i = 1;i < 8;i++){
			cin >> field1[i];
		}
		for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				if(field1[i][j] == '1') field[i][j] = 1;
				else field[i][j] = 0;
			}
		}
		/*for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				cout << field[i][j];
			}
			cout << endl;
		}
		cout << endl;*/
		int n,k,flag = 0;
		for(n = 0;n < 8;n++){
			for(k = 0;k < 8;k++){
				if(field[n][k] == 1){
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}	

		if(field[n][k] == field[n][k+1]){
			if(field[n][k+1] == field[n][k+2]) cout << "C" << endl;
			else if(field[n][k+1] == field[n+1][k+1]){
				if(field[n+1][k] == field[n+1][k+1]) cout << "A" << endl;
				else if(field[n+1][k+1] == field[n+1][k+2]) cout << "E" << endl;
			}
			else if(field[n][k+1] == field[n+1][k]) cout << "G" << endl;
		}
		else if(field[n][k] == field[n+1][k]){
			if(field[n+1][k] == field[n+2][k]) cout << "B" << endl;
			else if(field[n+1][k] == field[n+1][k-1]) cout << "D" << endl;
			else if(field[n+1][k] == field[n+1][k+1]) cout << "F" << endl;
		}

	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	
	int d[64];
	char c[64];
	
	while(1){
		int k=0;
		for(int i=0;i<64;i++){c[i]=0;d[i]=0;}
		for(int i=0;i<64;i++){cin>>c[i];
			if(c[i]=='1'){d[k]=i;k+=1;}}
		if(k!=4)return 0;
		if(d[1]==d[0]+1){
			if(d[2]==d[0]+2)cout<<"C"<<endl;
			else if(d[2]==d[0]+7)cout<<"G"<<endl;
			else if(d[2]==d[0]+8)cout<<"A"<<endl;
			else cout<<"E"<<endl;
		}
		else if(d[1]==d[0]+8){
			if(d[2]==d[0]+8)cout<<"B"<<endl;
			else cout<<"F"<<endl;
		}
		else cout<<"D"<<endl;
	}
}