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>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
 
int xb[7][3] = {
        {1, 0, 1},
        {0, 0, 0},
        {1, 2, 3},
        {0, -1, -1},
        {1, 1, 2},
        {0, 1, 1},
        {1, 0, -1}
};
 
int yb[7][3] = {
        {0, 1, 1},
        {1, 2, 3},
        {0, 0, 0},
        {1, 1, 2},
        {0, 1, 1},
        {1, 1, 2},
        {0, 1, 1}
};
 
int main() {
        string field[8];
        while(getline(cin, field[0])) {
        for(int i = 1; i < 8; i++) getline(cin, field[i]);
#if 1
        char ans = '\0';
        rep(y,8) {
                rep(x,8) {
                        if(field[y][x] == '1') {
                                // cerr << "x: " << x << " " << "y: " << y << endl;
                                rep(i,8) {
                                        bool f = true;
                                        rep(j,3) {
                                                int nx = xb[i][j];
                                                int ny = yb[i][j];
                                                if(0 <= nx && nx < 8 && 0 <= ny && ny < 8) {
                                                        if(field[y+ny][x+nx] != '1') {
                                                                f = false;
                                                                break;
                                                        }
                                                }       
                                        }
                                        if(f) {
                                                ans = 'A' + i;
                                                goto END;
                                        }
                                }
                        }
                }
        }
END:
        cout << ans << endl;
#endif
        getline(cin, field[0]);
        }
        return 0;
}

C++: //33
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(;;){
    char g[8][8];
    for(int y=0;y<8;y++){
      for(int x=0;x<8;x++){
	if(!(cin>>g[y][x]))return 0;
      }
    }
    for(int y=0;y<8;y++){
      for(int x=0;x<8;x++){
	if(g[y][x]=='1'){
	  int a=0;
	  for(int i=0;i<4;i++){
	    for(int j=0;j<4;j++){
	      a=(a<<1)+(y+i<8&&x+j<8&&g[y+i][x+j]=='1');
	    }
	  }
	  static const int f[]={0xcc00,0x8888,0xf000,0x8800,0xc600,0x8c40,0xc800};
	  cout<<char(find(f,f+7,a)-f+'A')<<endl;
	  goto next;
	}
      }
    }
  next:
    ;
  }
  return 0;
}

C++: #include <stdio.h>
int main() {
    char RB[8][9],i,j;while (scanf("%s",&RB[0])!=EOF) {for (i=1;i<8;scanf("%s",&RB[i++]));
        for (i=0;i<8;i++) for (j=0;j<8;j++) if (RB[i][j]=='1') {if (j<=4 && RB[i][j+1]=='1' && RB[i][j+2]=='1' && RB[i][j+3]=='1') puts("C"); else if (i<=4 && RB[i+1][j]=='1' && RB[i+2][j]=='1' && RB[i+3][j]=='1') puts("B"); else if (i<7 && j<7 && RB[i+1][j]=='1' && RB[i][j+1]=='1') puts("A");
        else if (i<6 && RB[i+2][j-1]=='1') puts("D"); else if (RB[i+1][j-1]=='1') puts("G"); else if (j<6 && RB[i+1][j+2]=='1') puts("E"); else puts("F"); i=10,j=10;}}return 0;}

C++: #include<iostream>
#include<cstring>
using namespace std;
int x[13][13];
int main() {
	while (true) {
		memset(x, 0, sizeof(x));
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				cin >> x[i][j];
			}
		}
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (x[i][j] == 1) {
					if (x[i + 1][j] == 1 && x[i][j + 1] == 1 && x[i + 1][j + 1] == 1) {
						cout << 'A' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 2][j] == 1 && x[i + 3][j] == 1) {
						cout << 'B' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i][j + 2] == 1 && x[i][j + 3] == 1) {
						cout << 'C' << endl; goto Exit;
					}
					if (x[i + 1][j - 1] == 1 && x[i + 1][j] == 1 && x[i + 2][j - 1] == 1) {
						cout << 'D' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j + 1] == 1 && x[i + 1][j + 2] == 1) {
						cout << 'E' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 1][j + 1] == 1 && x[i + 2][j + 1] == 1) {
						cout << 'F' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j - 1] == 1 && x[i + 1][j] == 1) {
						cout << 'G' << endl; goto Exit;
					}
				}
			}
		}
	Exit:;
	}
}

C++: #include <stdio.h>
#include <string.h>

int main(void){
	char b[65];
	char p[7][33] = {
		"1100000011",
		"10000000100000001000000010000000",
		"1111",
		"1000000110000001",
		"11000000011",
		"100000001100000001",
		"110000011",
	};
	char *bi;

	int t = 0;
	while(true){
		if(scanf("%s", b) == EOF){ break; }
		for(int i=1; i<8; ++i){
			scanf("%s", b+i*8);
		}
		bi = strchr(b, '1');
		for(int i=0; i<7; ++i){
			if(memcmp(bi, p[i], strlen(p[i])) == 0){
				printf("%c\n", 'A' + i);
				break;
			}
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	while(1){
		char field[8][9];
		int left = 8, right = 0, top = 8, bottom = 0;
		rep(y, 8){
			if(scanf("%s", field[y]) == EOF)
				return 0;
			rep(x, 8){
				if(field[y][x] == '1'){
					left = min(left, x);
					right = max(right, x);
					top = min(top, y);
					bottom = max(bottom, y);
				}
			}
		}

		int w = right - left + 1, h = bottom - top + 1;
		if(h==4)
			puts("B");
		else if(w==4)
			puts("C");
		else if(w==2 && h==2)
			puts("A");
		else if(w==2 && h==3)
			puts(field[top][left] == '1' ? "F" : "D");
		else
			puts(field[top][left] == '1' ? "E" : "G");
	}
}