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 <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[8];
string ans;

	while(!cin.eof()){
		ans = "?";
		rep(i,8) rep(j,8) cin >> w[i][j];
		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 <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;
	
	
}