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 <cstdio>

int map[8][8];
int bs[8][3][2]={{{0,1},{1,0},{1,1}},
		 {{0,1},{0,2},{0,3}},
		 {{1,0},{2,0},{3,0}},
		 {{0,1},{-1,1},{-1,2}},
		 {{1,0},{1,1},{2,1}},
		 {{0,1},{1,1},{1,2}},
		 {{1,0},{0,1},{-1,1}}};

int f(int x,int y){
  if(x>=0 && x<8 && y>=0 && y<8)
    return map[x][y];
  else
    return 0;
}

int readtable(){
  for(int y=0; y<8; y++){
    for(int x=0; x<8; x++){
      char c=getchar();
      if(c==EOF) return 0;
      map[x][y]=c-'0';
    }
    getchar();
  }
  getchar();
  return 1;
}

int main(){
  while(readtable()){
    for(int y=0; y<8; y++){
      for(int x=0; x<8; x++){
	if(map[x][y]==1){
	  for(int i=0; i<7; i++){
	    if(f(x+bs[i][0][0],y+bs[i][0][1])&&f(x+bs[i][1][0],y+bs[i][1][1])&&f(x+bs[i][2][0],y+bs[i][2][1])){
	      printf("%c\n",'A'+i);
	      goto outer;
	    }
	  }
	}
      }
    }
  outer: ;
  }
}

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

string s[10];

int main() {
	while(1){
		int t = 0;
		int r = 0;
		bool flag = false;
		for (int i = 0; i < 9; i++) {
			if (!(cin >> s[i]))return 0;
		}
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++)
			{
				if (s[i][j] == '1') {
					if (flag == false) { t = 8 * i + j; flag = true; };
					r += 8 * i + j;
				}
			}
		}
		r -= 4 * t;
		if (r == 18)cout << 'A' << endl;
		else if (r == 48)cout << 'B' << endl;
		else if (r == 6)cout << 'C' << endl;
		else if (r == 30)cout << 'D' << endl;
		else if (r == 20)cout << 'E' << endl;
		else if (r == 34)cout << 'F' << endl;
		else if (r == 16)cout << 'G' << endl; }
}

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

int main(){
	string line[8];

	while(1){


		int w = 0, h = 0, t=-1;

		for(int i=0;i<8;++i)
			cin >> line[i];

		int right=0,left=7;

		for(int i=0;i<8;++i){
			bool exist = false;
			for(int j=0;j<8;++j){
				if((line[i])[j] == '1'){
					if(t!=-1)t=i;
					if(j>right)right = j;
					if(j<left)left = j;
					exist = true;
				}
			}
			if(exist)++h;
		}
		w = right - left + 1;

		if( w == 2 && h == 2 )cout<<"A"<<endl;
		else if(w == 1)cout<<"B"<<endl;
		else if(h == 1)cout<<"C"<<endl;


		else if(w==2){
			for(int i=0;i<8;++i){
				if((line[i])[left] == '1'){
					if((line[i])[left+1]=='1')
						cout<<"D"<<endl;
					else
						cout<<"F"<<endl;
					break;
				}
			}
		}

		else if(h==2){
			for(int i=0;i<8;++i){
				if((line[t])[i]=='1'){
					if((line[t+1])[i]=='1')
						cout<<"G"<<endl;
					else
						cout<<"E"<<endl;
				}
			}
		}

	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int cnt=0;
string  w[12];
string ans;

	while(!cin.eof()){
		ans = "G";
		rep(i,8)  cin >> w[i];
		if(cin.eof()) break;
		rep(i,8) rep(j,8) if(w[i][j] == '1'){
			if(w[i][j+1]=='1' &&  w[i][j+2]=='1' && w[i][j+3]=='1'){
				ans = "C";  break; }
			if(w[i][j+1] =='1' && w[i+1][j+1]=='1' &&  w[i+1][j]=='1' ){
				ans = "A";  break; }
			if(w[i+1][j-1]=='1' && w[i+1][j]=='1' && w[i+2][j-1]=='1'){
				ans = "D";  break; }
			if(w[i][j+1]=='1' && w[i+1][j+1]=='1' && w[i+1][j+2]=='1'){
				ans = "E";  break; }
			if(w[i+1][j]=='1' && w[i+1][j+1]=='1' && w[i+2][j+1]=='1'){
				ans = "F";  break; }
			if(w[i][j+1]=='1' && w[i+1][j-1]=='1' && w[i+1][j]=='1' ){
				ans = "G";  break; }
			if(w[i+1][j]=='1' && w[i+2][j]=='1' && w[i+3][j]=='1' ){
				ans = "B";  break; }
			}
		cout <<  ans << endl;
//		cnt++; if(cnt>40) break;
	}
	return 0;
	
	
}

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

void Figure(int str[8][8]){
  int i, k;

  for(i = 0;i < 8;i++){
    for(k = 0;k < 8;k++){
      if(str[i][k] == 1){ //1???????????????
	if(str[i][k + 1] == 1){ //?????¢???A,C,E,G?????????
	  if(str[i][k + 2] == 1){ //???????????°C
	    cout << "C" << endl;
	  }else{ //?????????A,E,G
	    if(str[i + 1][k + 1] == 0){ //???????????°G
	      cout << "G" << endl;
	    }else{ // ?????????A,E
	      if(str[i + 1][k] == 1){ //???????????°A
		cout << "A" << endl; //?????????E
	      }else{
		cout << "E" << endl;
	      }
	    }
	  }
	}else{ //?¬?????????¢B,D,F?????¢???
	  if(str[i + 2][k] == 1){ //???????????°B
	    cout << "B" << endl;
	  }else{ //?????????D,F
	    if(str[i + 1][k + 1] == 1){ //???????????°F
	      cout << "F" << endl;
	    }else{ //?????????D
	      cout << "D" << endl;
	    }
	  }
	}
      }
    }
  }
}


int main(){
  int str[8][8], i, k;

  while(scanf("%d", &str[0][0]) != EOF){
    for(i = 0;i < 8;i++){
      for(k = 0;k < 8;k++){
	if(i != 0 && k != 0){
	  cin >> str[i][k];
	}
      }
    }
    Figure(str);
  }

  return 0;
}

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

/*
0123
456
78
9
*/
const int data[7][10] = {
						{1, 1, 0, 0, 1, 1, 0, 0, 0, 0},
						{1, 0, 0, 0, 1, 0, 0, 1, 0, 1},
						{1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
						{0, 1, 0, 0, 1, 1, 0, 1, 0, 0},
						{1, 1, 0, 0, 0, 1, 1, 0, 0, 0},
						{1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
						{0, 1, 1, 0, 1, 1, 0, 0, 0, 0}
						};

const int change[10][2] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 3}, {1, 3}, {0, 4}};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	char c0;
	while(cin >> c0){
		int c[15][15];
		for(int i = 0; i < 15; ++i){
			for(int j = 0; j < 15; ++j){
				c[j][i] = 0;
			}
		}

		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				if(i != 0 || j != 0) cin >> c0;
				c[j][i] = (c0 == '0') ? 0 : 1;
			}
		}

		bool check2 = false;
		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				for(int k = 0; k < 7; ++k){
					bool check = true;
					for(int l = 0; l < 10; ++l){
						if(c[j + change[l][0]][i + change[l][1]] != data[k][l]){
							check = false;
							break;
						}
					}
					if(check){
						cout << char('A' + k) << endl;
						check2 = true;
						break;
					}
				}
				if(check2) break;
			}
			if(check2) break;
		}
	}

	return 0;
}