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)
		fmt.Scanln()
	}
}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

const int N = 8;
char m[N][N];

inline bool check(int x, int y){ return 0<=x&&x<N && 0<=y&&y<N; }

int main()
{
  while(true){
    rep(i, N) rep(j, N) if(!(cin >> m[i][j])) return 0;

    rep(i, N) rep(j, N) if(m[i][j] == '1'){
      if(check(i+1, j+1) && m[i+1][j]=='1' && m[i][j+1]  =='1' && m[i+1][j+1]=='1') cout << "A" << endl;
      if(check(i+3, j  ) && m[i+1][j]=='1' && m[i+2][j]  =='1' && m[i+3][j]  =='1') cout << "B" << endl;
      if(check(i  , j+3) && m[i][j+1]=='1' && m[i][j+2]  =='1' && m[i][j+3]  =='1') cout << "C" << endl;
      if(check(i+2, j-1) && m[i+1][j]=='1' && m[i+1][j-1]=='1' && m[i+2][j-1]=='1') cout << "D" << endl;
      if(check(i+1, j+2) && m[i][j+1]=='1' && m[i+1][j+1]=='1' && m[i+1][j+2]=='1') cout << "E" << endl;
      if(check(i+2, j+1) && m[i+1][j]=='1' && m[i+1][j+1]=='1' && m[i+2][j+1]=='1') cout << "F" << endl;
      if(check(i+1, j+1) &&
         check(i+1, j-1) && m[i][j+1]=='1' && m[i+1][j-1]=='1' && m[i+1][j]  =='1') cout << "G" << endl;
      break;
    }
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
char ma[8][8];

void c(int x,int y){

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

}

int main(){



    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	cin >> ma[i][j]; 
      }
    }

    int f = 0;
    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(ma[i][j] == '1'){
	  c(j,i);
	  f = 1;
	}
	if(f)break;
      }
    if(f)break;    
  }
  return 0;
}

C++: #include<cstdio>

using namespace std;
int map[8][8];
int block[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}
	},
	{
		{1,0,0,0},
		{1,0,0,0},
		{0,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}
	},
	{
		{1,1,0,0},
		{1,0,0,0},
		{0,0,0,0},
		{0,0,0,0}
	}
};

int main()
{
	int x=-1,y=-1;
	while(true)
	{
		x=-1,y=-1;
	for(int i=0;i<8;i++)
	{
		char c[10];
		if(scanf("%s",c)==EOF)goto end;
		for(int j=0;j<8;j++)
		{
			map[i][j]=c[j]-'0';
			if(map[i][j]==1&&x==-1&&y==-1)
			{
				y=i,x=j;
			}
		}
	}
	for(int i=0;i<7;i++)
	{
		bool b=true;
		for(int j=0;j<4;j++)
		{
			for(int k=0;k<4;k++)
			{
				if(map[y+j][x+k]!=block[i][j][k])b=false;
			}
		}
		if(b)printf("%c\n",'A'+i);
	}
	}
	end:
	return 0;
}

C++: //0036
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	while (!cin.eof()) {
		char c[8][8];
		for (int i = 0; i < 8; i++)
			for (int j = 0; j < 8; j++)
				cin >> c[i][j];
		int a, b;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (c[i][j] == '1') {
					a = i;
					b = j;
					goto C;
				}
			}
		}
	C:
		if (c[a][b + 1] == '1') {
			if (c[a + 1][b] == '1') {
				if (c[a + 1][b + 1] == '1')
					cout << 'A';
				else cout << 'G';
			}
			else {
				if (c[a + 1][b + 1] == '1')
					cout << 'E';
				else cout << 'C';
			}
		}
		else if (c[a + 1][b + 1] == '1')
			cout << 'F';
		else if (c[a - 1][b + 1] == '1')
			cout << 'D';
		else cout << 'B';
		cout << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

double eps = 1e-10;

int main() {
	string s[16];
	while(cin >> s[0]){
		for(int i = 1; i < 8; ++i){
			cin >> s[i];
		}
		int h, w;
		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				if(s[i][j] == '1'){
					h = i;
					w = j;
					goto next;
				}
			}
		}
		next:;
		if(s[h + 1][w] == '1' && s[h][w + 1] == '1' && s[h + 1][w + 1] == '1'){
			cout << "A" << endl;
		}
		else if(s[h + 1][w] == '1' && s[h + 2][w] == '1' && s[h + 3][w] == '1'){
			cout << "B" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h][w + 2] == '1' && s[h][w + 3] == '1'){
			cout << "C" << endl;
		}
		else if(s[h + 1][w - 1] == '1' && s[h + 1][w] == '1' && s[h + 2][w - 1] == '1'){
			cout << "D" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h + 1][w + 1] == '1' && s[h + 1][w + 2] == '1'){
			cout << "E" << endl;
		}
		else if(s[h + 1][w] == '1' && s[h + 1][w + 1] == '1' && s[h + 2][w + 1] == '1'){
			cout << "F" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h + 1][w] == '1' && s[h + 1][w - 1] == '1'){
			cout << "G" << endl;
		}
	}
	return 0;
}