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>
using namespace std;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

char t[10][10];
int w = 8;
int h = 8;

int dx[][4] = {
  {0,1,0,1},
  {0,0,0,0},
  {0,1,2,3},
  {0,-1,0,-1},
  {0,1,1,2},
  {0,0,1,1},
  {0,1,-1,0},
};
int dy[][4] = {
  {0,0,1,1},
  {0,1,2,3},
  {0,0,0,0},
  {0,1,1,2},
  {0,0,1,1},
  {0,1,1,2},
  {0,0,1,1},
};

int check(int y,int x,int kind){
  for(int i=0;i<4;i++){
    int nx = x + dx[kind][i];
    int ny = y + dy[kind][i];
    if(nx>=0 && nx<w && ny>=0 && ny<h){
        if(t[ny][nx] != '1'){
          return false;
        }
    }
  }
    return true;
}

void solve(){
  rep(i,h){
    rep(j,w){
      rep(k,7){
        int tmp = check(i,j,k);
        if(tmp){
          cout<<(char)('A'+k)<<endl;
          return;
        }
      }
    }
  }
}

int main(){
  while(1){
    rep(i,h){
      if(!(cin>>t[i])) return 0;
    }
    solve();
  }
}

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

int main(){
    char mat[8][9]={0};
    
    while(cin >> mat[0]){
        char ans;
        
        for(int i = 1; i < 8 ; i++) cin >> mat[i];
        
        for(int i = 0 ; i < 8 ; i++)
            for(int j = 0 ; j < 8 ; j++)
                mat[i][j] -= '0';
        
        for(int i = 0 ;  ; i++){
            for(int j = 0 ; j < 8 ; j++){
                if(mat[i][j] == 1){
                    if(mat[i][j+3]) ans = 'C';
                    else if(mat[i+3][j]) ans = 'B';
                    else if(mat[i][j+1]&&mat[i+1][j]&&mat[i+1][j+1]) ans = 'A';
                    else if(mat[i+1][j-1]&&mat[i+2][j-1]) ans = 'D';
                    else if(mat[i][j+1]&&mat[i+1][j+2]) ans = 'E';
                    else if(mat[i+1][j]&&mat[i+2][j+1]) ans = 'F';
                    else ans = 'G';
                    
                    goto end;
                }
                
            }
        }
        end:
        cout << ans << endl;
        
        }

    
    return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    enum blocks{
        A = 18, B = 48, C = 6, D = 30, E = 20, F = 34, G = 16
    };
    string surface, input;
    while(cin >> input){
        surface = input;
        rep(i,7){
            cin >> input;
            surface+= input;
        }
        int first = 0, location = 0;
        rep(i,65){
            if(surface[i] == '1' && first == 0){
                first = i;
            }else if(surface[i] == '1'){
                location+= i - first;
            }
        }
        if(A == location) cout << 'A' << endl;
        else if(B == location) cout << 'B' << endl;
        else if(C == location) cout << 'C' << endl;
        else if(D == location) cout << 'D' << endl;
        else if(E == location) cout << 'E' << endl;
        else if(F == location) cout << 'F' << endl;
        else if(G == location) cout << 'G' << endl;
    }
}

C++: #include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
    char field[65];
    char a[7][26]={
        "1100000011",
        "1000000010000000100000001",
        "1111",
        "1000000110000001",
        "11000000011",
        "100000001100000001",
        "110000011"
    };
    while(cin>>field){
        for(int i=1;i<8;i++)scanf("%s",field+i*8);
        char *pnt;
        pnt=strchr(field,'1');
        for(int i=0;i<7;i++){
            if(!strncmp(pnt,a[i],strlen(a[i]))){
                char x='A'+i;
                cout<<x<<endl;
                break;
            }
        }
    }
    return 0;
}

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;
}