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 <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

char field[11][11],field2[11][11];

int main(void){
	while(1){
		int i,j;
		bool flag=false;
		for(j=0;j<11;j++){
			for(i=0;i<11;i++){
				field[i][j]='\0';
				field2[i][j]='\0';
			}
		}
		for(i=0;i<8;i++){
			if(scanf("%s",field[i])==EOF){
				flag=true;
				break;
			}
		}
		if(flag)break;
		for(j=0;j<8;j++){
			for(i=0;i<8;i++){
				field2[i][j]=field[j][i];
			}
		}
		for(j=0;j<8;j++){
			for(i=0;i<8;i++){
				if(field2[i][j]=='1' && field2[i+1][j]=='1' && field2[i][j+1]=='1' && field2[i+1][j+1]=='1')printf("A\n");
				if(field2[i][j]=='1' && field2[i][j+1]=='1' && field2[i][j+2]=='1' && field2[i][j+3]=='1')printf("B\n");
				if(field2[i][j]=='1' && field2[i+1][j]=='1' && field2[i+2][j]=='1' && field2[i+3][j]=='1')printf("C\n");
				if(field2[i+1][j]=='1' && field2[i+1][j+1]=='1' && field2[i][j+1]=='1' && field2[i][j+2]=='1')printf("D\n");
				if(field2[i][j]=='1' && field2[i+1][j]=='1' && field2[i+1][j+1]=='1' && field2[i+2][j+1]=='1')printf("E\n");
				if(field2[i][j]=='1' && field2[i][j+1]=='1' && field2[i+1][j+1]=='1' && field2[i+1][j+2]=='1')printf("F\n");
				if(field2[i][j+1]=='1' && field2[i+1][j+1]=='1' && field2[i+1][j]=='1' && field2[i+2][j]=='1')printf("G\n");
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

int main()
{
	char ret;
	string s;
	
	for(int i=0;i<8;i++){
		string s_tmp;
		cin>>s_tmp;
		s += s_tmp;
	}
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	cout<<ret<<endl;
	return 0;
}

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

int main()
{
  char field[8][8];

  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      cin >> field[i][j];
    }
  }
  
  bool judge = false;
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      if (field[i][j] == '1'){
        if (field[i + 3][j] == '1'){
          cout << 'B';
        }
        else if (field[i][j + 3] == '1'){
          cout << 'C';
        }
        else if (field[i + 2][j - 1] == '1'){
          cout << 'D';
        }
        else if (field[i + 1][j + 2] == '1'){
          cout << 'E';
        }
        else if (field[i + 2][j + 1] == '1'){
          cout << 'F';
        }
        else if (field[i + 1][j - 1] == '1'){
          cout << 'G';
        }
        else {
          cout << 'A';
        }
        judge = true;
      }
      if (judge)  break;
    }
    if (judge)  break;
  }
  cout << endl;
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int dx[7][4]={{0,0,1,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,-1,0,1}};
int dy[7][4]={{0,1,1,0},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,1,1,0}};
string MAP[8];
string ans="ABCDEFG";

int main(){
	while(1){
	for(int i=0; i<8; ++i){
		cin >> MAP[i];
		if(!cin.eof()){
			return 0;
		}
	}
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			if(MAP[i][j]=='1'){
				for(int k=0; k<7; ++k){
					bool ok=true;
					for(int l=0; l<4; ++l){
						int nx=j+dx[k][l];
						int ny=i+dy[k][l];
						if((0<=nx&&nx<8&&0<=ny&&ny<8&&MAP[ny][nx]!='1')||(nx<0||8<=nx||ny<0||8<=ny)){
							ok=false;
							break;
						}
					}
					if(ok){
						cout << ans[k] << "\n";
						break;
					}
				}
			}
		}
	}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

int main(){
	int fig[8];
	while(cin>>fig[0]){
		for(int i=1;i<8;i++) cin>>fig[i];
		for(int i=0;i<8;i++){
			if(fig[i]!=0){
				if(fig[i]==fig[i+1]&&fig[i]%11==0)
				printf("A\n");
				else if(fig[i]==fig[i+1]&&fig[i]==fig[i+2])
				printf("B\n");
				else if(fig[i]%1111==0)
				printf("C\n");
				else if(fig[i+1]==fig[i]*10+fig[i])
				printf("D\n");
				else if(fig[i+1]==fig[i]/10)
				printf("E\n");
				else if(fig[i+1]==fig[i]+fig[i]/10)
				printf("F\n");
				else if(fig[i+1]==fig[i]*10)
				printf("G\n");
				break;
			}
		}
	}
}