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(), "")
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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 <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int table[10][10];
string s;

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };

void solve(int i, int j){
	if (table[i + 3][j] == 1){
		cout << "B" << endl;
		return;
	}
	if (table[i][j + 3] == 1){
		cout << "C" << endl;
		return;
	}
	if (j >= 1 && table[i + 2][j - 1] == 1){
		cout << "D" << endl;
		return;
	}
	if (table[i + 1][j + 2] == 1){
		cout << "E" << endl;
		return;
	}
	if (table[i + 2][j + 1] == 1){
		cout << "F" << endl;
	}
	if (table[i][j + 1] == 1){
		if (table[i + 1][j + 1] == 1){
			cout << "A" << endl;
			return;
		}
		else if (j >= 1 && table[i + 1][j - 1] == 1){
			cout << "G" << endl;
			return;
		}
	}
}

int main(){
	while (cin >> s){
		for (int i = 0; i < s.size(); i++){
			table[0][i] = s[i] - '0';
		}
		FOR(i, 1, 8){
			cin >> s;
			for (int j = 0; j < s.size(); j++){
				table[i][j] = s[j] - '0';
			}
		}
		REP(i, 8){
			REP(j, 8){
				if (table[i][j] == 1){
					solve(i, j);
					break;
				}
			}
		}
	}
}

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

int main(void)
{
	string str[8];

	while(cin >> str[0]){

		int c[8][8];
		int p[4];
		int count = 0;

		for(int i=1; i<8; i++)
			cin >> str[i];

		for(int i=0; i<8; i++)
		{
			for(int j=0; j<8; j++)
			{
				c[i][j] = atoi(str[i].substr(j,1).c_str());
				if(c[i][j])
				{
					p[count] = i*10 + j;
					count++;
				}
			}
		}

		if( p[0] + 1 == p[1] && p[0] + 10 == p[2] && p[0] + 11 == p[3] )
			cout << "A" << endl;
		else if( p[0] + 10 == p[1] && p[0] + 20 == p[2] && p[0] + 30 == p[3] )
			cout << "B" << endl;
		else if( p[0] + 1 == p[1] && p[0] + 2 == p[2] && p[0] + 3 == p[3] )
			cout << "C" << endl;
		else if( p[0] + 9 == p[1] && p[0] + 10 == p[2] && p[0] + 19 == p[3] )
			cout << "D" << endl;
		else if( p[0] + 1 == p[1] && p[0] + 11 == p[2] && p[0] + 12 == p[3] )
			cout << "E" << endl;
		else if( p[0] + 10 == p[1] && p[0] + 11 == p[2] && p[0] + 21 == p[3] )
			cout << "F" << endl;
		else if( p[0] + 1 == p[1] && p[0] + 9 == p[2] && p[0] + 10 == p[3] )
			cout << "G" << endl;

	}

	return 0;
}

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

int main()
{
     int num[8];
     int pattan[7][4] = {{11000000, 11000000, 0, 0},
                         {10000000, 10000000, 10000000, 10000000},
                         {11110000, 0, 0, 0},
                         {1000000, 11000000, 10000000, 0},
                         {11000000, 1100000, 0, 0},
                         {10000000, 11000000, 1000000, 0},
                         {1100000, 11000000, 0, 0} };
     while (cin >> num[0]) {
          for (int i = 1; i < 8; i++) cin >> num[i];
          int t = 0;
          while (num[t] == 0) t++;
          //char
          for (int i = 0; i < 7; i++) {
               //sift
               for (int j = 0; j < 8;j++) {
                    //good mach
                    int flag = 1, tmp = 1;
                    for (int k = 0; k < j; k++) tmp *= 10;
                    for (int k = 0; k < 4; k++)
                         if (num[t + k] != (pattan[i][k] / tmp)) flag = 0;
                    char str = 'A' + i;
                    if (flag) cout << str << endl;
               }
          }
     }

     return 0;
}

C++: //0036
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	while (!cin.eof()) {
		char c[8][8];
		for (int i = 0; i < 8; i++)
			for (int j = 0; j < 8; j++)
				cin >> c[i][j];
		int a, b;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (c[i][j] == '1') {
					a = i;
					b = j;
					goto C;
				}
			}
		}
	C:
		if (c[a][b + 1] == '1') {
			if (c[a + 1][b] == '1') {
				if (c[a + 1][b + 1] == '1')
					cout << 'A';
				else cout << 'G';
			}
			else {
				if (c[a + 1][b + 1] == '1')
					cout << 'E';
				else cout << 'C';
			}
		}
		else if (c[a + 1][b + 1] == '1')
			cout << 'F';
		else if (c[a + 1][b - 1] == '1')
			cout << 'D';
		else cout << 'B';
		cout << endl;
	}
}

C++: #include<iostream>
#include<vector>
#include<array>
#include<string>
#include<sstream>
#define _X_ 0
#define _Y_ 1
int main()
{
	while (true)
	{
		std::vector<std::array<int, 2>>p;
		p.reserve(4);
		for (int i = 0; i < 8; i++)
		{
			std::string temp;
			std::cin >> temp;
			std::stringstream st(temp);
			for (int j = 0; j < 8; j++)
			{
				char foo;
				st >> foo;
				if (foo == '1')
				{
					p.push_back({ j, i });
				}
			}
		}
		if (p[0][_Y_] == p[1][_Y_])
		{
			if (p[0][_X_] == p[2][_X_])
			{
				std::cout << 'A' << std::endl;
			}
			else if (p[0][_Y_] == p[2][_Y_])
			{
				std::cout << 'C' << std::endl;
			}
			else if (p[1][_X_] == p[2][_X_])
			{
				std::cout << 'E' << std::endl;
			}
			else if (p[0][_X_] == p[3][_X_])
			{
				std::cout << 'G' << std::endl;
			}
		}
		else
		{
			if (p[0][_X_] == p[3][_X_])
			{
				std::cout << 'B' << std::endl;
			}
			else if (p[0][_X_] > p[3][_X_])
			{
				std::cout << 'D' << std::endl;
			}
			else
			{
				std::cout << 'F' << std::endl;
			}
		}
	}
	return 0;
}