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 <bits/stdc++.h>
using namespace std;

int main() {
  char str[20][20];
  while(1) {
    for ( int i = 4; i < 12; i++ ){
      for ( int j = 4; j < 12; j++ ) {
      cin >> str[i][j];
      if ( cin.eof() ) return 0;
      }
    }
    char ans;
    for ( int i = 4; i < 12; i++ ) {
      for ( int j = 4; j < 12; j++ ) {
      if ( str[i][j] == '1' && str[i][j+1] == '1' && 
	   str[i+1][j] == '1' && str[i+1][j+1] == '1' ) ans = 'A';
      else if ( str[i][j] == '1' && str[i+1][j] == '1' &&
		str[i+2][j] == '1' && str[i+3][j] =='1' ) ans = 'B';
      else if ( str[i][j] == '1' && str[i][j+1] == '1' &&
		str[i][j+2] == '1' && str[i][j+3] == '1' ) ans = 'C';
      else if ( str[i][j] == '1' && str[i+1][j-1] == '1' &&
		str[i+1][j] == '1' && str[i+2][j-1] == '1' ) ans = 'D';
      else if ( str[i][j] == '1' && str[i][j+1] == '1' &&
		str[i+1][j+1] == '1' && str[i+1][j+2] == '1' ) ans = 'E';
      else if ( str[i][j] == '1' && str[i+1][j] == '1' &&
		str[i+1][j+1] == '1' && str[i+2][j+1] == '1' ) ans = 'F';
      else if ( str[i][j] == '1' && str[i][j+1] == '1' &&
		str[i+1][j-1] == '1' && str[i+1][j] == '1' ) ans = 'G';
							 
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

map<set<pair<int, int>>, int>mp;

int main() {
	mp[set<pair<int, int>>{make_pair(0, 0), make_pair(0, 1), make_pair(0, 2), make_pair(0, 3)}] = 1;
	mp[set<pair<int, int>>{make_pair(0, 0), make_pair(0, 1), make_pair(1, 1), make_pair(1, 0)}] = 0;
	mp[set<pair<int, int>>{make_pair(0, 0), make_pair(1, 0), make_pair(2, 0), make_pair(3, 0)}] = 2;
	mp[set<pair<int, int>>{make_pair(0, 1), make_pair(1, 0), make_pair(0, 2), make_pair(1, 1)}] = 3;
	mp[set<pair<int, int>>{make_pair(0, 0), make_pair(1, 0), make_pair(2,1), make_pair(1, 1)}] = 4;
	mp[set<pair<int, int>>{make_pair(0, 0), make_pair(0, 1), make_pair(1, 1), make_pair(1, 2)}] = 5;
	mp[set<pair<int, int>>{make_pair(1, 0), make_pair(0, 1), make_pair(1, 1), make_pair(2, 0)}] = 6;
	vector<string>sts(8);
	while (cin >> sts[0]) {
		for (int i = 1; i < 8; ++i)cin >> sts[i];
		int minx = 10;
		int miny = 10;
		
		for (int i = 0; i < 8; ++i) {
			for (int j = 0; j < 8; ++j) {
				if (sts[i][j] == '1') {
					minx = min(minx, j);
					miny = min(miny, i);
				}
			}
		}
		set<pair<int, int>>ps;
		for (int i = 0; i < 8; ++i) {
			for (int j = 0; j < 8; ++j) {
				if (sts[i][j] == '1') {
					ps.emplace(j - minx, i - miny);
				}
			}
		}
		if (mp.find(ps) == mp.end())assert(false);
		cout <<char( 'A' + mp[ps]) << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

struct P{ double x, y; };

bool Range(int x, int y)
{ return 0 <= x && x < 8 && 0 <= y && y < 8; }


const int target[7][3][2] = 
{
	{{1, 0}, {0, 1}, {1, 1}},
	{{0, 1}, {0, 2}, {0, 3}}, 
	{{1, 0}, {2, 0}, {3, 0}},
	{{0, 1}, {-1,1}, {-1,2}},
	{{1, 0}, {1, 1}, {2, 1}},
	{{0, 1}, {1, 1}, {1, 2}},
	{{1, 0}, {0, 1}, {-1,1}}
};



char solve(vector<string>& field)
{
	rep(x, 8) rep(y, 8) rep(t, 7)
	{
		if(Range(x, y) && field[y][x] == '1')
		{
			rep(p, 3)
			{
				int nx = x + target[t][p][0], ny = y + target[t][p][1];
				if(!Range(nx, ny) || field[ny][nx] != '1')
					break;
				else if(p == 2)
				{
					return 'A' + t;
				}
			}
		}
	}

	return 'Z';
}



int main()
{
	vector<string> f(8);
	while(cin >> f[0] >> f[1] >> f[2] >> f[3] >> f[4] >> f[5] >> f[6] >> f[7])
		cout << solve(f) << endl;	
}