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 <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	char table[8][9];

	while(scanf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",table[0],table[1],table[2],table[3],table[4],table[5],table[6],table[7])!=EOF){

		bool FLG = false;
		for(int i=0; i < 8; i++){
			for(int k=0; k<8; k++){
				if(table[i][k] == '1'){
					if(i <= 6 && k <= 6 && table[i][k+1] == '1' && table[i+1][k] == '1' && table[i+1][k+1] == '1'){
						printf("A\n");
						FLG = true;
						break;
					}else if(i <= 4 && table[i+1][k] == '1' && table[i+2][k] == '1' && table[i+3][k] == '1'){
						printf("B\n");
						FLG = true;
						break;
					}else if(k <= 4 && table[i][k+1] == '1' && table[i][k+2] == '1' && table[i][k+3] == '1'){
						printf("C\n");
						FLG = true;
						break;
					}else if(i <= 5 && k >= 1 && table[i+1][k-1] == '1' && table[i+1][k] == '1' &&
							table[i+2][k-1] == '1'){
						printf("D\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 5 && table[i][k+1] == '1' && table[i+1][k+1] == '1' &&
							table[i+1][k+2] == '1'){
						printf("E\n");
						FLG = true;
						break;
					}else if(i <= 5 && k <= 6 && table[i+1][k] == '1' && table[i+1][k+1] == '1' &&
							table[i+2][k+1] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 6 && k >= 1 && table[i][k+1] == '1' && table[i+1][k-1] == '1' &&
							table[i+i][k] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}
	}


	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    while (1)
    {
        string d[8];
        rep(i, 8)
        {
            cin >> d[i];
            if (cin.eof())
                return 0;
        }

        int st_x, st_y, ed_x, ed_y;
        rep(i, 8)
        {
            int flag = 0;
            rep(j, 8)
            {
                if (d[i][j] == '1')
                {
                    st_x = j, st_y = i;
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
                break;
        }
        rep(i, 8)
        {
            rep(j, 8)
            {
                if (d[i][j] == '1')
                {
                    ed_x = j, ed_y = i;
                }
            }
        }

        int dis_x = ed_x - st_x, dis_y = ed_y - st_y;

        if (dis_y == 0)
        {
            OP("C")
        }
        else if (dis_y == 1)
        {

            if (dis_x == 0)
                OP("G")
            if (dis_x == 1)
                OP("A")
            if (dis_x == 2)
                OP("E")
        }
        else if (dis_y == 2)
        {
            if (dis_x == -1)
                OP("D")
            if (dis_x == 1)
                OP("F")
        }
        else if (dis_y == 3)
        {
            OP("B")
        }
    }

    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main(){
 
  string s[10];
 
  while(cin >> s[0]){
    for(int i=1;i<8;i++) cin >> s[i];
 
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
 
    if(s[i][j] == '1'){
      if(s[i][j+1] == '1' && s[i+1][j] == '1' && s[i+1][j+1] == '1') cout << 'A' << endl;
      else if(s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1') cout << 'B' << endl;
      else if(s[i][j+1] == '1' && s[i][j+3] == '1' && s[i][j+3] == '1') cout << 'C' << endl;
      else if(s[i+1][j-1] == '1' && s[i+1][j] == '1' && s[i+2][j-1] == '1') cout << 'D' << endl;
      else if(s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1') cout << 'E' << endl;
      else if(s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1') cout << 'F' << endl;
      else if(s[i][j+1] == '1' && s[i+1][j-1] == '1' && s[i+1][j] == '1') cout << 'G' << endl;
    }
 
      }
    }
  }
}

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

int pos[7][4] = {{0, 1, 10, 11}, {0, 10, 20, 30}, {0, 1, 2, 3},
{1, 10, 11, 20}, {0, 1, 11, 12}, {0, 10, 11, 21}, {1, 2, 10, 11}};
char s[110] = {0};

int main()
{
	int i, j, k;
	
	while( scanf("%s", s + 1) != -1 ){
		for( i = 1; i < 8; i++ )
			scanf("%s", s + 10 * i + 1);
		
		for( i = 0; i < 7; i++ ){
			for( j = 0; j < 100; j++ ){
				for( k = 0; k < 4; k++ ){
					if( pos[i][k] + j >= 110 || s[pos[i][k] + j] != '1' )
						break;
				}
				if( k == 4 )	//??????????????´????????¨??¨'1'?????£?????´???????????????
					break;
			}
			if( j < 100 )	//?????§???????????´???????????????
				break;
		}
		printf("%c\n", 'A' + i );
	}
	return 0;
}

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

char m[8][8];
void figure(int, int);

int main() {

	while(1) {
		bool f = true;
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				cin >> m[i][j];
			}
		}
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				if(m[i][j] == '1') {
					figure(i, j);
					f = false;
					break;
				}
			}
			if(!f) {
				break;
			}
		}
	}
}


void figure(int i, int j) {
	char s;
	if(m[i][j+1] == '1' && m[i+1][j+1]== '1' && m[i+1][j]== '1') {
		s = 'A';
	}
	else if(m[i+1][j] == '1' && m[i+2][j] == '1') {
		s = 'B';
	}
	else if(m[i][j+1] == '1' && m[i][j+2] == '1') {
		s = 'C';
	}
	else if(m[i][j+1] == '1' && m[i+1][j+1] == '1') {
		s = 'E';
	}
	else if(m[i][j+1] == '1') {
		s = 'G';
	}
	else if(m[i+1][j+1] == '1') {
		s = 'F';
	}
	else {
		s = 'D';
	}
	cout << s << endl;
}