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( j, i, k ) )
					{
						answer += k;
						not_found = false;
					}
				}
			}
		}

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

C++: #include <iostream>
using namespace std;
char ma[8][8];
bool p(int i,int j){return (0<=i&&i<8&&0<=j&&j<8)&&(ma[i][j] == '1');}
void c(int x,int y){

  if(p(y-3,x))cout << 'B'<<endl;
  else if(p(y,x-3))cout << 'C' << endl;
  else if(p(y-2,x+1))cout << 'D' << endl;
  else if(p(y-1,x-2))cout << 'E' << endl;
  else if(p(y-2,x-1))cout << 'F' << endl;
  else if(p(y,x-1) &&p(y-1,x+1))cout << 'G' << endl;
  else cout << 'A' <<endl;

}

int main(){
  int x,y;
  while(cin >> ma[0][0]){

    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(i + j == 0)continue;
	cin >> ma[i][j]; 
	if(ma[i][j] == '1'){x = j,y = i;}
      }
    }

    int f = 0;
    c(x,y);
  }
  return 0;
}

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

char sur[14][14];
const char WALL=10;

int main(void){
	char c;

	while(scanf("%c",&c)!=EOF){
		for(int y=0;y<14;y++){
			for(int x=0;x<14;x++){
				if(x<3 || x>10 || y<3 || y>10) sur[y][x]=WALL;
				else if(x==3 && y==3) sur[y][x]=c;
				else scanf(" %c",&(sur[y][x]));
			}
		}

		for(int y=0;y<14;y++){
			for(int x=0;x<14;x++){
				if(sur[y][x]=='1'){
					if(sur[y][x+1]=='1' && sur[y+1][x]=='1' && sur[y+1][x+1]=='1') cout<<"A\n";
					else if(sur[y+1][x]=='1' && sur[y+2][x]=='1' && sur[y+3][x]=='1') cout<<"B\n";
					else if(sur[y][x+1]=='1' && sur[y][x+2]=='1' && sur[y][x+3]=='1') cout <<"C\n";
					else if(sur[y+1][x]=='1' && sur[y+1][x-1]=='1' && sur[y+2][x-1]=='1') cout<<"D\n";
					else if(sur[y][x+1]=='1' && sur[y+1][x+1]=='1' && sur[y+1][x+2]=='1') cout<<"E\n";
					else if(sur[y+1][x]=='1' && sur[y+1][x+1]=='1' && sur[y+2][x+1]=='1') cout<<"F\n";
					else if(sur[y][x+1]=='1' && sur[y+1][x]=='1' && sur[y+1][x-1]=='1') cout<<"G\n";
					break;
				}
			}
		}
	}

	return 0;
}

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

int main() {
  char x;
 NEXT:
  for(int i=0;i<100;i++) {
    cin.get(x);
    if(x == '1') {
      break;
    }
  }
  cin.get(x);
  if(x == '1') {// A,C,E,G
    cin.get(x);
    if(x == '1') // C
      cout << "C" << endl;
    else if(x == '0') {//A,E,G
      for(int i=0;i<6;i++){
        cin.get(x);
      }
      if(x == '1')
        cout << "G" << endl; // G
      else if(x == '0') {
        cin.get(x);
        if(x == '1')
          cout << "A" << endl; // A
        else
          cout << "E" << endl; // E
      }
    }
  }
  else if(x == '0') {//B,D,F
    for(int i=0;i<6;i++) {
      cin.get(x);
    }
    if(x == '1')
      cout << "D" << endl;
    else if(x == '0') {
      cin.get(x);
      cin.get(x);
      if(x == '1')
        cout << "F" << endl;
      else
        cout << "B" << endl;
    }
  }
  for(int i=0;i<80;i++) {
    cin.get(x);
    if(cin.eof()) {goto END;}
    else if(x == '\n'){
      cin.get(x);
      if(x == '\n')
        goto NEXT;
    }
  }
 END:
  return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

char Types(char x[12][11]);

int main () {
    char x[100];
    for(int i=0; i<100; i++){
        x[i]='0';
    }
    int flag = 1;

    while(flag){

        for(int i=0; i<64; i++){
            //cin>>x[i];
            if(scanf("%c",&x[i])==EOF){
                flag=0;
                break;
            }
        }
        if(flag!=1){
            break;
        }
        
        int first;
        for(int i=0; i<64; i++){
            if(x[i]=='1'){
                first=i;
                break;
            }
        }
        
        if(x[first+1]=='1'){
            if(x[first+2]=='1'){
                cout<<"C"<<endl;
            }else if(x[first+7]=='1'){
                cout<<"G"<<endl;
            }else if(x[first+10]=='1'){
                cout<<"E"<<endl;
            }else{
                cout<<"A"<<endl;
            }
        }else{
            if(x[first+7]=='1'){
                cout<<"D"<<endl;
            }else if(x[first+9]=='1'){
                cout<<"F"<<endl;
            }else{
                cout<<"B"<<endl;
            }
        }
        
        
    }
    
    return 0;
}