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<cstdio>

using namespace std;

int A[7][4][4]={
  
  {
    {1,1,0,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
  },
  
  {
    {1,1,1,1},
    {0,0,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,0,0},
    {1,1,0,0},
    {1,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,1,0,0},
    {0,1,1,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,1,0,0},
    {0,1,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,1,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
},
  
  a[12][12];

string s="ABCDEFG";

bool check(int x, int y, int n){
  
  for(int k=0;k<4;k++){
    for(int l=0;l<4;l++){
      int nx=x+k,ny=y+l;
      if(A[n][k][l]==1){
	if(a[nx][ny]!=A[n][k][l]){
	  return false;
	}
	if(nx<0||nx>7||ny<0||ny>7){
	  return false;
	}
      }
    }
  }
  return true;
}


int main(void){

  char ch;

  while(true){

    for(int i=0;i<12;i++)
      for(int j=0;j<12;j++)
	a[i][j]=0;
    
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	if(scanf(" %c",&ch)==EOF)return 0;
	a[i][j]=ch-'0';
      }
    }
    bool fg=true;
    for(int k=0;fg && k<7;k++){
      for(int i=0;fg && i<8;i++){
	for(int j=0;fg && j<8;j++){
	  if(check(i,j,k)){
	    cout << s[k] << endl;
	    fg=false;
	  }
	}
      }
    }
  }

  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()
{
	while(!cin.eof())
	{	
		vector<string> field;

		rep(i, 8)
		{
			string str;
			cin >> str;
			field.push_back(str);
		}


		cout << solve(field) << endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#define rep(i,n) for(int i = 0 ; i < n ;i++ )
using namespace std;

int main(){
 char  ma[8][8];
  while(!cin.eof()){
    rep(i,8){
      rep(j,8){
ma[i][j]='0';
      }
    }
    rep(i,8){
      rep(j,8){
	cin >> ma[i][j];

      }
    }
    rep(i,8){
      rep(j,8){
	if(ma[i][j]=='1'){
	  if(ma[i][j+1] == '1' && ma[i+1][j+1] == '1'&& i+1 < 8&&j+1 < 8 ){
	    cout << 'A' << endl;
	    goto f;
	  }else if(ma[i+3][j] == '1' &&i+3 < 8){
	    cout << 'B' << endl;
	    goto f;
	  }else if(ma[i][j+3] == '1'&& j+3 < 8){
	    cout << 'C' << endl;
	    goto f;
	  }else if(ma[i+3][j-1] == '1' && i+3 < 8 && 0 < j-1){
	    cout << 'D' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1<8 && j+3 < 8){
	    cout << 'E' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1 < 8&& j+3 < 8){
	    cout << 'F' << endl;
	    goto f;
	  }else if(ma[i][j+1] == '1' && ma[i+1][j-1] == '1' && j+1 < 8 && i+1 < 8 && 0<j-1 ){
	    cout << 'G' << endl;
	    goto f;
	  }
	}
      }
    }
  f:
  }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int field[8][8],f = 0;
	for(;;){
		for(int i=0; i<8; i++){
			for(int l=0; l<8; l++){
				if(scanf("%1d",&field[l][i]) == EOF){f = 1;break;}
			}
			if(f == 1){break;}
		}
		if(f == 1){break;}
		for(int i=0; i<8; i++){
			for(int l=0; l<8; l++){
				if(field[l][i]){
					if(field[l][i+1] == 1 && field[l+1][i] == 1 && field[l+1][i+1] == 1){cout<<"A"<<endl;break;}
					else if(field[l][i+1] == 1 && field[l][i+2] == 1 && field[l][i+3] == 1){cout<<"B"<<endl;break;}
					else if(field[l+1][i] == 1 && field[l+2][i] == 1 && field[l+3][i] == 1){cout<<"C"<<endl;break;}
					else if(field[l][i+1] == 1 && field[l-1][i+1] == 1 && field[l-1][i+2] == 1){cout<<"D"<<endl;break;}
					else if(field[l+1][i] == 1 && field[l+1][i+1] == 1 && field[l+2][i+1] == 1){cout<<"E"<<endl;break;}
					else if(field[l][i+1] == 1 && field[l+1][i+1] == 1 && field[l+1][i+2] == 1){cout<<"F"<<endl;break;}
					else if(field[l+1][i] == 1 && field[l][i+1] == 1 && field[l-1][i+1] == 1){cout<<"G"<<endl;break;}
				}
			}
		}
	}
	return 0;
}