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 <bits/stdc++.h>

using namespace std;

char mp[8][9];

int A[4][2] = {{0, 0}, {0, 1}, {1, 0}, {1, 1}};
int B[4][2] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}};
int C[4][2] = {{0, 0}, {0, 1}, {0, 2}, {0, 3}};
int D[4][2] = {{0, 1}, {1, 0}, {1, 1}, {2, 0}};
int E[4][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 2}};
int F[4][2] = {{0, 0}, {1, 0}, {1, 1}, {2, 1}};
int G[4][2] = {{1, 0}, {1, 1}, {0, 1}, {0, 2}};

int main()
{
    int nyan = 0;
    while (1) {
        int i = 0;
        while (1) {
            int res = scanf("%s", mp[i++]);
            if (res == EOF) return 0;
            if (i == 8) break;
        }

        int cnt;

        for (int i = 0; i < 8; ++i) for (int j = 0; j < 8; ++j) {
            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + A[k][0], nx = j + A[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("A");
                continue;
            }

            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + B[k][0], nx = j + B[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("B");
                continue;
            }

            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + C[k][0], nx = j + C[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("C");
                continue;
            }

            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + D[k][0], nx = j + D[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("D");
                continue;
            }

            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + E[k][0], nx = j + E[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("E");
                continue;
            }

            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + F[k][0], nx = j + F[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("F");
                continue;
            }

            cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int ny = i + G[k][0], nx = j + G[k][1];
                if (ny < 0 || ny >= 8 || nx < 0 || nx >= 8 || mp[ny][nx] == '0') break;
                cnt++;
            }
            if (cnt == 4) {
                puts("G");
                continue;
            }
        }
    }
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to) 

int main() {
	int t[7][4][4] = {{{1, 1, 0, 0},
					   {1, 1, 0, 0},
					   {0, 0, 0, 0},
					   {0, 0, 0, 0}},

					  {{1, 0, 0, 0},
					   {1, 0, 0, 0},
					   {1, 0, 0, 0},
					   {1, 0, 0, 0}},

					  {{1, 1, 1, 1},
					   {0, 0, 0, 0},
					   {0, 0, 0, 0},
					   {0, 0, 0, 0}},
					  
					  {{0, 1, 0, 0},
			      	   {1, 1, 0, 0},
					   {1, 0, 0, 0},
					   {0, 0, 0, 0}},
					  
					  {{1, 1, 0, 0},
					   {0, 1, 1, 0},
					   {0, 0, 0, 0},
					   {0, 0, 0, 0}},
					  
					  {{1, 0, 0, 0},
					   {1, 1, 0, 0},
					   {0, 1, 0, 0},
					   {0, 0, 0, 0}},
					
				   	  {{0, 1, 1, 0},
				   	   {1, 1, 0, 0},
					   {0, 0, 0, 0},
					   {0, 0, 0, 0}}};
	string str;
	while(cin >> str) {
		vector<string> s(8);
		s[0] = str;
		int board[11][11];
		rep2(i,1,8) {
			cin >> s[i];
		}
		rep(i,11) {
			rep(j,11) {
				board[i][j] = 0;
			}
		}
		
		rep(i,8) {
			rep(j,8) {
				board[i][j] = s[i][j] - '0';
			}
		}
		rep(i,64) {
			bool f = 1;
			rep(k,7) {
				f = 1;
				rep(l,16) {
					if(board[i / 8 + l / 4][i % 8 + l % 4] != t[k][l / 4][l % 4]) {
						f = 0;
						break;
					}
				}
				if(f) {
					cout << (char) (k + 'A') << endl;
					break;
				}
			}
			if(f) break;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <sstream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

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