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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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>

using namespace std;

int main()
{
	int i,j;
	char map[10][10];
	
	for(;cin >> map[0][0];)
	{
		int sx,sy,flag=0;;
		
		for(i=0;i<8;i++)
		{
			for(j=0;j<8;j++)
			{
				if(i==0 && j==0)
					j++;
				cin >> map[i][j];
				
				
				if(map[i][j]=='1' && flag==0)
				{
					sy=i;
					sx=j;
					flag=1;
				}
			}
		}
		
		if(map[sy][sx+1]=='1' && sx+1<8)
		{
			if(map[sy+1][sx]=='1' && sy+1<8)
			{
				if(map[sy+1][sx+1]=='1')
					cout << "A" << endl;
				else
					cout << "G" << endl;
			}
			else
			{
				if(map[sy][sx+2]=='1' && sx+2<8)
					cout << "C" << endl;
				else
					cout << "E" << endl;
			}
		}
		else
		{
			if(map[sy+2][sx]=='1' && sy+2<8)
				cout << "B" << endl;
			else
			{
				if(map[sy+1][sx+1]=='1' && sx+1<8)
					cout << "F" << endl;
				else
					cout << "D" << endl;
			}
		}
	}
}

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

struct ca {
	int x;
	int y;
};

int main() {
	ca l[4];
	int a = 0;
	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++){
			char c;
			cin >> c;
			if (c == '1')
			{
				l[a].x = i;
				l[a].y = j;
				a++;
			}
		}
	}
	int x = l[0].x;
	int y = l[0].y;
	if (l[1].x == x&&l[1].y == y + 1){
		//[l0][l1]
		//ACEG
		if (l[3].x == x + 1 && l[3].y == y + 1)
			cout << 'A';
		else if (l[3].y == y + 3)
			cout << 'C';
		else if (l[3].x == x + 1 && l[3].y == y + 2)
			cout << 'E';
		else cout << 'G';
	}
	else if (l[1].x == x + 1 && l[1].y == y){
		/*[l0]
		  [l1]*/
		//BF
		if (l[3].x == x + 3 && l[3].y == y) 
			cout << 'B';
		else cout << 'F';
	}
	else cout << 'D';
	cout << endl;
	char c;
	cin >> c;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long i,n,n2,f;
while(cin>>n){
i=2;
while(n==0){cin>>n;i++;}
if(i==8)f=2;
else{
cin>>n2;
if(n2==0)f=2;
else if(n2==n){if(n%11==0)f=0;else f=1;}
else if(n2==n*11)f=3;
else if(n2==n/10)f=4;
else if(n2==n*10)f=6;
else f=5;
for(;i<8;i++)cin>>n;
}
cout<<"ABCDEFG"[f]<<endl;
}
return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
char ta[10][10];
int main(){
	while(cin>>ta[1][1]){
		for(int i=1;i<=8;i++)for(int j=(i==1)+1;j<=8;j++)cin>>ta[i][j];
	
		for(int i=1;i<=8;i++){
			for(int j=1;j<=8;j++){
				char ans='?';
				if(ta[i][j]=='1'){
				if(ta[i+1][j]=='1'&&ta[i][j+1]=='1'&&ta[i+1][j+1]=='1')ans='A';
				
				else if(ta[i+1][j]=='1'&&ta[i+1][j]=='1'&&ta[i+3][j]=='1')ans='B';
				
				else if(ta[i][j+1]=='1'&&ta[i][j+2]=='1'&&ta[i][j+3]=='1')ans='C';
				
				else if(ta[i+1][j]=='1'&&ta[i+1][j-1]=='1'&&ta[i+2][j-1]=='1')ans='D';
				
				else if(ta[i][j+1]=='1'&&ta[i+1][j+1]=='1'&&ta[i+1][j+2]=='1')ans='E';
				
				else if(ta[i+1][j]=='1'&&ta[i+1][j+1]=='1'&&ta[i+2][j+1]=='1')ans='F';
				
				else if(ta[i][j+1]=='1'&&ta[i+1][j]=='1'&&ta[i+1][j-1]=='1')ans='G';
				}
				if(ans!='?'){cout<<ans<<endl;goto next;}
			}
		}
	
	next:;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[9];
	int count = 0;
	while(getline(cin, field1[0])){
		if(count == 0){
			for(int i = 1;i < 8;i++){
				getline(cin, field1[i]);
			}
		}
		if(count != 0){
			for(int i = 1;i < 9;i++){
				getline(cin, field1[i]);
			}
		}
		if(count == 0){	
			for(int i = 0;i < 8;i++){
				for(int j = 0;j < 8;j++){
					if(field1[i][j] == '1') field[i][j] = 1;
					else field[i][j] = 0;
				}
			}
		}
		if(count != 0){
			for(int i = 1;i < 9;i++){
				for(int j = 0;j < 8;j++){
					if(field1[i][j] == '1') field[i-1][j] = 1;
					else field[i-1][j] = 0;
				}
			}
		}
		/*for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				cout << field[i][j];
			}
			cout << endl;
		}
		cout << endl;*/
		for(int i = 0;i < 8;i++){
			int flag = 0;
			for(int j = 0;j < 8;j++){
				if(field[i][j] == 1){
					//cout << i << j <<endl;
					if(field[i][j] == field[i][j+1]){
						if(field[i][j] == field[i+1][j]){
							if(field[i][j] == field[i+1][j+1]){
								cout << "A" << endl;
								flag = 1;break;
							}
							else if(field[i][j] == field[i+1][j-1]){
								cout << "G" << endl;
								flag = 1;break;
							}
						}
						else if(field[i][j] == field[i][j+2] && field[i][j] == field[i][j+3]){
							cout << "C" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+1][j+2]){
							cout << "E" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j]){
						if(field[i][j] == field[i+1][j-1] && field[i][j] == field[i+2][j-1]){
							cout << "D" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+2][j+1]){
							cout << "F" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j] && field[i][j] == field[i+2][j] && field[i][j] == field[i+3][j]){
						cout << "B" << endl;
						flag = 1;break;
					}
				}
			}
			if(flag == 1) break;
		}
		count++;
	}

	return 0;
}