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

vector <string> f;

const string P[7][4] = {
	{// A
		"1100",
		"1100",
		"0000",
		"0000"
	},
	{// B
		"1000",
		"1000",
		"1000",
		"1000"
	},
	{// C
		"1111",
		"0000",
		"0000",
		"0000"
	},
	{// D
		"0100",
		"1100",
		"1000",
		"0000"
	},
	{// E
		"1100",
		"0110",
		"0000",
		"0000"
	},
	{// F
		"1000",
		"1100",
		"0100",
		"0000"
	},
	{// G
		"0110",
		"1100",
		"0000",
		"0000"
	},
};

bool check( int x, int y, int k )
{
	for ( int i = 0; i < 4; i++ )
	{
		for ( int j = 0; j < 4; j++ )
		{
			int nx = x + j;
			int ny = y + i;
			if ( P[k][i][j] == '1' )
			{
				if ( nx < 0 || nx > 8 || ny < 0 || ny > 8 )
				{
					return false;
				}
				if ( P[k][i][j] != f[ny][nx] )
					return false;
			}
		}
	}
	return true;
}

int main( void )
{
	while ( cin.eof() == false )
	{
		f = vector <string>(8);
		string line;
		for ( int i = 0; i < 8; i++ )
		{
			getline( cin, line );
			f[i] = line;
			if ( cin.eof() ) break;
		}
		if ( cin.eof() ) break;
		getline( cin, line );

		char answer = 'A';
		bool not_found = true;
		for ( int i = 0; not_found && i < 8; i++ )
		{
			for ( int j = 0; not_found && j < 8; j++ )
			{
				for ( int k = 0; not_found && k < 7; k++ )
				{
					if ( check( i, j, k ) )
					{
						answer += k;
						not_found = false;
					}
				}
			}
		}

		cout << answer << endl;
	}
	return 0;
}

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

int main(){

  string s[10];

  while(cin >> s[0]){
    for(int i=1;i<8;i++) cin >> s[i];

    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){

	if(s[i][j] == '1'){
	  if(s[i][j+1] == '1' && s[i+1][j] == '1' && s[i+1][j+1] == '1') cout << 'A' << endl;
	  else if(s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1') cout << 'B' << endl;
	  else if(s[i][j+1] == '1' && s[i][j+3] == '1' && s[i][j+3] == '1') cout << 'C' << endl;
	  else if(s[i+1][j-1] == '1' && s[i+1][j] == '1' && s[i+2][j-1] == '1') cout << 'D' << endl;
	  else if(s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1') cout << 'E' << endl;
	  else if(s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1') cout << 'F' << endl;
	  else if(s[i][j+1] == '1' && s[i+1][j-1] == '1' && s[i+1][j] == '1') cout << 'G' << endl;
	}

      }
    }
  }
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int cnt=0,x,y;
	char zero;
	while(cin>>zero){
		char masu[8][8];
		cnt=0;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(i==0&&j==0){
					masu[0][0]=zero;
				}else{
					cin>>masu[i][j];
				}
				if(masu[i][j]=='1'&&cnt==0){
					x=i,y=j;
					cnt++;
				}
			}
		}
		if(masu[x][y+1]=='1'){
			if(masu[x][y+2]=='1'){
				cout<<"C"<<endl;
			}else if(masu[x+1][y]=='0'){
				cout<<"E"<<endl;
			}else if(masu[x+1][y+1]=='0'){
				cout<<"G"<<endl;
			}else{
				cout<<"A"<<endl;
			}
		}else{
			if(masu[x+1][y-1]=='1'){
				cout<<"D"<<endl;
			}else if(masu[x+1][y+1]=='1'){
				cout<<"F"<<endl;
			}else{
				cout<<"B"<<endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
char data[8][8];


struct P{
	P(){};
	P(int a,int b){
		x=a;
		y=b;
	}
	int x,y;
};

bool input(){
	for(int i=0;i<8;i++){
		if( scanf( "%s",data[i] ) == EOF )return false;
	}
	return true;
}
int main(){
	
	while(input()){
		P o;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(data[i][j]=='1'){
					o=P(j,i);
					goto suc;
				}
			}
		}
		suc:;
		{
			for(int i=0;i<2;i++){
				for(int j=0;j<2;j++){
					if(o.y+i>=8 || o.x+j>=8)goto fail1;
					if(data[o.y+i][o.x+j]!='1')goto fail1;
				}
			}
			cout<<"A"<<endl;
			continue;
			fail1:;
		}
		{
			for(int i=0;i<4;i++){
				if(o.y+i>=8)goto fail2;
				if(data[o.y+i][o.x]!='1')goto fail2;
			}
			cout<<"B"<<endl;
			continue;
			fail2:; 
		}
		{
			for(int i=0;i<4;i++){
				if(o.x+i>=8)goto fail3;
				if(data[o.y][o.x+i]!='1')goto fail3;
			}
			cout<<"C"<<endl;
			continue;
			fail3:;
		}
		{
			if(o.y+2>=8 || o.x-1<=0)goto fail4;
			if(data[o.y+1][o.x]!='1')goto fail4;
			if(data[o.y+1][o.x-1]!='1')goto fail4;
			if(data[o.y+2][o.x-1]!='1')goto fail4;
			cout<<"D"<<endl;
			continue;
			fail4:;
		}
		{
			if(o.x+2>=8 || o.y+1>=8)goto fail5;
			if(data[o.y][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+2]!='1')goto fail5;
			cout<<"E"<<endl;
			continue;
			fail5:;
		}
		{
			if(o.x+1>=8 || o.y+2>=8)goto fail6;
			if(data[o.y+1][o.x]!='1')goto fail6;
			if(data[o.y+1][o.x+1]!='1')goto fail6;
			if(data[o.y+2][o.x+1]!='1')goto fail6;
			cout<<"F"<<endl;
			continue;
			fail6:;
		}
		{
			cout<<"G"<<endl;
		}
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int b[20][20] = {{0}};
int &pos(int y, int x){
  return b[y+5][x+5];
}

int main(){
  string str;
  while(cin>>str){
    int i = 0;
    do{
      REP(j,8)
	pos(i,j) = str[j] - '0';
    }while(++i<8 && cin>>str);

    char ans;
    REP(y,8) REP(x,8){
      if(pos(y,x) == 1){
	if(pos(y+3,x) == 1)
	  ans = 'B';
	else if(pos(y,x+3) == 1)
	  ans = 'C';
	else if(pos(y+2,x-1) == 1)
	  ans = 'D';
	else if(pos(y+1,x+2) == 1)
	  ans = 'E';
	else if(pos(y+2,x+1) == 1)
	  ans = 'F';
	else if(pos(y,x+1) == 1 && pos(y+1,x-1) == 1)
	  ans = 'G';
	else
	  ans = 'A';
	goto end;
      }
    }
  end:
    cout << ans << endl;
  }
  return 0;
}