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>

int main(void) {
  char s[8][10];
  int i, j, k, l;
  int dx[7][3] = {
    {1, 1, 0},
    {0, 0, 0},
    {1, 2, 3},
    {0, -1, -1},
    {1, 1, 2},
    {0, 1, 1},
    {1, -1, 0}
  }, dy[7][3] = {
    {0, 1, 1},
    {1, 2, 3},
    {0, 0, 0},
    {1, 1, 2},
    {0, 1, 1},
    {1, 1, 2},
    {0, 1, 1}
  };
  while(scanf("%s", s[0]) != EOF) {
    for(i = 1; i < 8; ++i) scanf("%s", s[i]);
    int t = 1;
    for(i = 0; i < 8; ++i) {
      for(j = 0; j < 8; ++j) {
        if(s[i][j] == '1') {
          for(k = 0; k < 7; ++k) {
            for(l = 0; l < 3; ++l) {
              if(i + dy[k][l] < 0 || i + dy[k][l] >= 8 || j + dx[k][l] < 0 || j + dx[k][l] >= 8 || s[i + dy[k][l]][j + dx[k][l]] == '0') break;
            }
            if(l == 3) {
              printf("%c\n", 'A' + k);
              break;
            }
          }
          t = 0;
          break;
        }
      }
      if(!t) break;
    }
  }
  return 0;
}

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];

int main(){
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			cin >> MAP[i][j];
		}
	}
	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'){
							ok=false;
							break;
						}
					}
					if(ok){
						switch(k){
						case 0:
							cout << "A\n";
							return 0;
							break;
						case 1:
							cout << "B\n";
							return 0;
							break;
						case 2:
							cout << "C\n";
							return 0;
							break;
						case 3:
							cout << "D\n";
							return 0;
							break;
						case 4:
							cout << "E\n";
							return 0;
							break;
						case 5:
							cout << "Fn";
							return 0;
							break;
						case 6:
							cout << "G\n";
							return 0;
							break;
						default:
							break;
						}
					}
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	char a;
	bool hantei;
	while (cin >> a) {
		int graph[10][10] = {0};
		hantei = false;
		graph[1][1] = a - '0';
		for (int j = 2; j < 9; j++) {
			cin >> a;
			graph[1][j] = a - '0';
		}
		for (int i = 2; i < 9; i++) {
			for (int j = 1; j < 9; j++) {
				cin >> a;
				graph[i][j] = a - '0';
			}
		}
		for (int i = 1; i < 9; i++) {
			for (int j = 1; j < 9; j++) {
				if (graph[i][j] == 1) {
					if (graph[i][j+1] == 1) {
						if (graph[i+1][j+1] == 1) {
							if (graph[i+1][j] == 1) {
								cout << 'A' << endl;
							} else {
								cout << 'E' << endl;
							}
						} else {
							if (graph[i+1][j] == 1) {
								cout << 'G' << endl;
							} else {
								cout << 'C' << endl;
							}
						}
					} else {
						if (graph[i+2][j] == 1) {
							cout << 'B' << endl;
						} else {
							if (graph[i+1][j+1] == 1) {
								cout << 'F' << endl;
							} else {
								cout << 'D' << endl;
							}
						}
					}
					hantei = true;
					break;
				}
			}
			if (hantei == true) {
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int const MOD = 1000000007;

int main() {
    string s[] = {"1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011"};
    char c[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};
    string a[8];
    while(cin >> a[0]) {
        rep(i,1,8) cin >> a[i];
        string merge;
        rep(i,0,8) merge += a[i];

        rep(i,0,7) {
            if(merge.find(s[i]) != string::npos) cout << c[i] << endl;
        }
    }
    return 0;
}