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 <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	int dx[7][3] = 
	{
		{ 1, 0, 1 },
		{ 0, 0, 0 },
		{ 1, 2, 3 },
		{ -1, 0, -1 },
		{ 1, 1, 2 },
		{ 0, 1, 1 },
		{ 1, -1, 0 }
	};
	int dy[7][3] =
	{
		{ 0, 1, 1 },
		{ 1, 2, 3 },
		{ 0, 0, 0 },
		{ 1, 1, 2 },
		{ 0, 1, 1 },
		{ 1, 1, 2 },
		{ 0, 1, 1 },
	};

	char bb[256];
	char* next = (char*)1;
	while (next)
	{
		char buf[8][8];
		int i;
		for (i = 0; i < 8; ++i)
		{
			fgets(bb, 256, stdin);
			for (int j = 0; j < 8; ++j)
				buf[i][j] = bb[j];
		}
		next = fgets(bb, 256, stdin);
		if (i != 8)
			break;

		int x, y;
		for (y = 0; y < 8; ++y)
		{
			for (x = 0; x < 8; ++x)
			{
				if (buf[y][x] == '1')
					break;
			}
			if (buf[y][x] == '1')
				break;
		}

		for (i = 0; i < 7; ++i)
		{
			int j;
			for (j = 0; j < 3; ++j)
			{
				int tx = x+dx[i][j];
				int ty = y+dy[i][j];
				if (tx < 0 || ty < 0 || tx >= 8 || ty >= 8
					|| buf[ty][tx] == '0')
					break;
			}
			if (j == 3)
				break;
		}
		printf("%c\n", 'A'+i);
	}

	return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    char aa;
    while(cin>>aa){
    char tmp[10][10]={};
    tmp[0][0]=aa;
    rep(i,8) rep(j,8) if(i!=0 || j!=0)cin>>tmp[i][j];
    int data[10][10]={};
    rep(i,8) rep(j,8) data[i][j]=tmp[i][j]-'0';
    
    rep(i,8){
        rep(j,8){
            if(data[i][j]){
                if( i+1<8           && j+1<8 && data[i+1][j] && data[i][j+1] && data[i+1][j+1] ){cout<<"A"<<endl;goto next;}
                if( i+3<8           && data[i+1][j] && data[i+2][j] && data[i+3][j] ){cout<<"B"<<endl;goto next;}
                if( j+3<8           && data[i][j+1] && data[i][j+2] && data[i][j+3] ){cout<<"C"<<endl;goto next;}
                if( i+2<8 && j-1>=0 && data[i+1][j] && data[i+1][j-1] && data[i+2][j-1] ){cout<<"D"<<endl;goto next;}
                if( i+1<8 && j+2<8  && data[i][j+1] && data[i+1][j+1] && data[i+1][j+2] ){cout<<"E"<<endl;goto next;}
                if( i+2<8 && j+1<8  && data[i+1][j] && data[i+1][j+1] && data[i+2][j+1] ){cout<<"F"<<endl;goto next;}
                if( i+1<8 && j-1>=0 && j+1<8 && data[i+1][j] && data[i][j+1] && data[i+1][j-1] ){cout<<"G"<<endl;goto next;}
            }
        }
    }
    next:;
    }
    
    return 0;
}

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

int main()
{
	while(!cin.eof())
	{
		long a[8] = {0};
		for(int i = 0; i < 8; i++)
		{
			long x;
			cin >> x;
			for(int j = 0; j < 8; j++)
			{
				a[i] += (x % 10) << j;
				x /= 10;
			}
		}

		/*for(int i = 0; i < 8; i++)
			cout << i << ' ' << a[i] << endl;
		*/

		char c = 'A';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'B';
		for(int i = 0; i < 5; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == (1 << j))
					if(a[i + 1] == (1 << j))
					{
						//cout << "B " << (1 << j) << endl;
						goto END;
					}

		c = 'C';
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 5; j++)
			{
				//cout << 'C' << ' ' << (15 << j) << endl;
				if(a[i] == 15 << j)
					goto END;

			}
		c = 'D';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 1 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'E';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j-1))
						goto END;

		c = 'F';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == 1 << j)
					goto END;

		c = 'G';

	END:
		cout << c << endl;
	}
	return 0;
}