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 <iostream>
#include <string>
#include <vector>
using namespace std;

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

bool inrange(int x, int y)
{

      return false;
      return true;
}

int main()
{
  for ( ; ; ) {
    vector<string> f(8);
    for (int i = 0; i < 8; ++i)
      getline(cin, f[i]);

    int sx = -1, sy = -1;
    for (int y = 0; y < 8; ++y) {
      for (int x = 0; x < 8; ++x) {
	if (f[y][x] != '0' && sx == -1 && sy == -1) {
	  sx = x;
	  sy = y;
	}
      }
    }

    for (int i = 0; i < 7; ++i) {
      int cnt = 0;
      for (int j = 0; j < 3; ++j) {
	int xx = sx + dx[i][j];
	int yy = sy + dy[i][j];
	if (xx < 0 || xx >= 8 || yy < 0 || yy >= 8)
	    continue;
	if (f[yy][xx] == '1')
	  ++cnt;
      }
	if (cnt == 3) {
	  cout << static_cast<char>('A'+i) << endl;
	  break;
	}
    }

    // blank
    if (!getline(cin, f[0]))
	break;
  }
  return 0;
}

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

int main(){
	int ax, ay;
	char f[12][12];
	bool flag = false;

	for(int y=0 ; y<12 ; y++){
		for(int x=0 ; x<12 ; x++){
			f[y][x] = 0;
		}
	}

	while( 1 ){
		for(int i=0 ; i<8 ; i++) {
			if( scanf("%s", f[i]) == EOF ){
				flag = true;
				break;
			}
		}
		if(flag) break;

		for(int i=0 ; i<64 ; i++){
			if(f[i/8][i%8]=='1'){
				ax = i%8;
				ay = i/8;
				break;
			}
		}
		if( f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' ){
			printf("A\n");
		}else if( f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1' ){
			printf("B\n");
		}else if( f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1' ){
			printf("C\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1' ){
			printf("E\n");
		}else if( f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1' ){
			printf("F\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("G\n");
		}else if( f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("D\n");
		}
	}
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int f[30][30] = {0};
  for(;;){
    if(scanf("%1d%1d%1d%1d%1d%1d%1d%1d%",&f[10][10],&f[11][10],&f[12][10],&f[13][10],&f[14][10],&f[15][10],&f[16][10],&f[17][10]) == EOF){break;}
    for(int i=1; i<8; i++){
      scanf("%1d%1d%1d%1d%1d%1d%1d%1d%",&f[10][10+i],&f[11][10+i],&f[12][10+i],&f[13][10+i],&f[14][10+i],&f[15][10+i],&f[16][10+i],&f[17][10+i]);
    }
    bool flag = true;
    for(int i=0; i<8; i++){
      for(int j=0; j<8; j++){
	if(f[10+i][10+j] && flag){
	  if(f[11+i][10+j] && f[10+i][11+j] && f[11+i][11+j]){cout <<"A"<<endl;flag = false;}
	  if(f[10+i][11+j] && f[10+i][12+j] && f[10+i][13+j]){cout <<"B"<<endl;flag = false;}
	  if(f[11+i][10+j] && f[12+i][10+j] && f[13+i][10+j]){cout <<"C"<<endl;flag = false;}
	  if(f[11+i][10+j] && f[10+i][11+j] && f[11+i][9+j]){cout <<"D"<<endl;flag = false;}
	  if(f[11+i][10+j] && f[11+i][11+j] && f[12+i][11+j]){cout <<"E"<<endl;flag = false;}
	  if(f[10+i][11+j] && f[11+i][11+j] && f[11+i][12+j]){cout <<"F"<<endl;flag = false;}
	  if(f[11+i][10+j] && f[11+i][9+j] && f[12+i][9+j]){cout <<"G"<<endl;flag = false;}
	}
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;

template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

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