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)
	}
}

C++: #include<iostream>

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";

void check(){


  for(int n=0;n<7;n++){

    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	bool fg=true;
	for(int k=0;k<4;k++){
	  for(int l=0;l<4;l++){
	    if(a[i+k][j+l]!=A[n][k][l]){
	      fg=false;
	      break;
	    }
	  }
	}
	if(fg){
	cout << s[n] << endl;
	  return;
	}
	fg=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++){
	cin.get(ch);
	if(cin.eof())return 0;
	a[i][j]=ch-'0';
      }
      cin.ignore();
    }
    check();
  }

  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
const int N = 8;

bool check(vector< vector<bool> > &v, int y, int x){
    if(y < 0 || x < 0 || y >= N || x >= N || !v[y][x]) return false;
    return true;
}

char isSame(vector< vector<bool> > &v, int y, int x){
    if(check(v, y, x) && check(v, y + 1, x) && check(v, y, x + 1) && check(v, y + 1, x + 1)) return 'A';
    if(check(v, y, x) && check(v, y + 1, x) && check(v, y + 2, x) && check(v, y + 3, x)) return 'B';
    if(check(v, y, x) && check(v, y + 1, x) && check(v, y + 2, x) && check(v, y + 3, x)) return 'B';
    if(check(v, y, x) && check(v, y, x + 1) && check(v, y, x + 2) && check(v, y, x + 3)) return 'C';
    if(check(v, y, x) && check(v, y + 1, x) && check(v, y + 1, x - 1) && check(v, y + 2, x - 1)) return 'D';
    if(check(v, y, x) && check(v, y, x + 1) && check(v, y + 1, x + 1) && check(v, y + 1, x + 2)) return 'E';
    if(check(v, y, x) && check(v, y + 1, x) && check(v, y + 1, x + 1) && check(v, y + 2, x + 1)) return 'F';
    if(check(v, y, x) && check(v, y, x + 1) && check(v, y + 1, x - 1) && check(v, y + 1, x)) return 'G';
    return 'n';
}

char allCheck(vector< vector<bool> > &v){
    REP(i, N) REP(j, N) if(v[i][j]) return isSame(v, i, j);
}

int main(){
    vector< vector<char> > tmp(N, vector<char>(N));
    while(cin >>tmp[0][0]){
        REP(i, N){
            REP(j, N){
                if(i == 0 && j == 0) continue;
                cin >>tmp[i][j];
            }
        }
        vector< vector<bool> > v(N, vector<bool>(N));
        REP(i, N) REP(j, N) v[i][j] = (tmp[i][j] == '1'? true : false);
        cout <<allCheck(v) <<endl;
    }
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
#define REPS(a,i,n) for(int i = a ; i < n ; ++i)
using namespace std;

int tile[20][20];


int main(){

	while (true){
		string a;
		if (cin.eof())
			break;
		/*
		for (size_t c = a.find_first_of(" "); c != string::npos;  c = a.find_first_of(" ")){
			a.erase(c, 1);
		}
		*/
		getline(cin, a);
		if (a.empty())continue;
		REP(j, 8){
			tile[3][7+3 - j] = '0' - a[7-j];
		}
		REP(i, 7){
			getline(cin,a); 
			/*for (size_t c = a.find_first_of(" "); c != string::npos; c = a.find_first_of(" ")){
				a.erase(c, 1);
			}*/

			REP(j, 8){
				tile[i+3 + 1][7+3 - j] = '0' - a[7-j];
			}
		}
		REP(i, 15){
			REP(j, 15){
				if (tile[i][j]){
					if (tile[i + 1][j] && tile[i][j + 1] && tile[i + 1][j + 1]){
						cout << "A" << endl;
						goto END;
					}
					if (tile[i][j+1] && tile[i+1][j + 1] && tile[i + 1][j + 2]){
						cout << "E" << endl;
						goto END;
					}
					if (tile[i+1][j] && tile[i+1][j + 1] && tile[i + 2][j + 1]){
						cout << "F" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i][j + 1] && tile[i + 1][j - 1]){
						cout << "G" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i+2][j] && tile[i + 3][j]){
						cout << "B" << endl;
						goto END;
					}
					if (tile[i][j+1] && tile[i][j + 2] && tile[i][j + 3]){
						cout << "C" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i+1][j - 1] && tile[i + 2][j - 1]){
						cout << "D" << endl;
						goto END;
					}
				}
			}
		}
	END:;
	}
	return 0;
}

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

int G[8][8];

bool in_range(int a,int b){
  return 0<= a && a < 8 && 0 <= b && b < 8;
}

void check(int x,int y)
{
  char res = 'A';
  if(in_range(y - 3,x)&&G[x][y - 3])res = 'B';
  else if(in_range(y,x - 3)&&G[x - 3][y])res = 'C';
  else if(in_range(y - 2,x+1 )&&G[x + 1][y  - 2])res = 'D';
  else if(in_range(y - 1,x-2 )&&G[x - 2][y  - 1])res = 'E';
  else if(in_range(y - 2,x-1 )&&G[x - 1][y  - 2])res = 'F';
  else if(in_range(y - 1,x-2 )&&G[x - 2][y  - 1])res = 'G';
  cout << res << endl;
}

int main(){
  int sx,sy;
  char c;
  for(int i = 0 ; i < 8 ; i++ ){
    for(int j = 0 ; j < 8 ; j++ ){
      cin >> c;
      G[j][i] = c - '0';
    if(G[j][i] == 1){
      sx = j;
      sy = i;
    }
    }
  }
  check(sx,sy);
}