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

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	char dp[8][8];
	char a='X';
	while(cin>>dp[0][0]){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(i!=0||j!=0)
			    cin>>dp[i][j];
		}
	}
	for(int i=0;i<8-1;i++){
		for(int j=0;j<8-1;j++){
			if(dp[i][j]=='1'&&dp[i][j+1]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1')
				a='A';
		}
	}
	for(int i=0;i<8-3;i++){
		for(int j=0;j<8;j++){
			if(dp[i][j]=='1'&&dp[i+1][j]=='1'&&dp[i+2][j]=='1'&&dp[i+3][j]=='1')
				a='B';
		}
	}
	for(int i=0;i<8;i++){
		for(int j=0;j<8-3;j++){
			if(dp[i][j]=='1'&&dp[i][j+1]=='1'&&dp[i][j+2]=='1'&&dp[i][j+3]=='1')
				a='C';
		}
	}
	for(int i=0;i<8-2;i++){
		for(int j=0;j<8-1;j++){
			if(dp[i][j+1]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1'&&dp[i+2][j]=='1')
				a='D';
		}
	}
	for(int i=0;i<8-1;i++){
		for(int j=0;j<8-2;j++){
			if(dp[i][j]=='1'&&dp[i][j+1]=='1'&&dp[i+1][j+1]=='1'&&dp[i+1][j+2]=='1')
				a='E';
		}
	}
	for(int i=0;i<8-2;i++){
		for(int j=0;j<8-1;j++){
			if(dp[i][j]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1'&&dp[i+2][j+1]=='1')
				a='F';
		}
	}
	for(int i=0;i<8-1;i++){
		for(int j=0;j<8-2;j++){
			if(dp[i][j+1]=='1'&&dp[i][j+2]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1')
				a='G';
		}
	}
	cout<<a<<endl;
	}
	return 0;
}