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
}

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<cstdlib>
using namespace std;

char charField[15][15];

int main(){
	while(cin >> charField[0][0]){

		for(int i=0; i < 15; i++){
			for(int j=0; j < 15; j++){
				charField[i][j] = '0';
			}
		}

		for(int i=0; i < 8; i++){
			for(int j=0; j < 8; j++){
				if(i==0 && j == 0)continue;
				cin >> charField[j][i];
			}
		}

		for(int i=0; i < 8; i++){
			for(int j=0; j < 8; j++){
				cout << charField[i][j];
			}
			cout << endl;
		}

		for(int i=0; i < 8; i++){
			for(int j=0; j < 8; j++){
				if(charField[i][j] == '1' && charField[i+1][j] == '1' && charField[i][j+1] && charField[i+1][j+1] == '1') cout << "A" << endl;
				else if(charField[i][j] == '1' && charField[i][j+1] == '1' && charField[i][j+2] == '1' && charField[i][j+3] == '1') cout << "B" << endl;
				else if(charField[i][j] == '1' && charField[i+1][j] == '1' && charField[i+2][j] == '1' && charField[i+3][j] == '1') cout << "C" << endl;
				else if(charField[i+1][j] == '1' && charField[i+1][j+1] == '1' && charField[i][j+1] == '1' && charField[i][j+2] == '1') cout << "D" << endl;
			 	else if(charField[i][j] == '1' && charField[i+1][j] == '1' && charField[i+1][j+1] == '1' && charField[i+2][j+1] == '1') cout << "E" << endl;
				else if(charField[i][j] == '1' && charField[i+1][j] == '1' && charField[i+1][j+1] == '1' && charField[i+1][j+2] == '1') cout << "F" << endl;
				else if(charField[i+1][j] == '1' && charField[i+1][j+1] == '1' && charField[i][j+1] == '1' && charField[i][j+2] == '1') cout << "G" << endl;
			}

		}
	}
}

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

struct ca {
	int x;
	int y;
};

int main() {
	ca l[4];
	char c;
	while (true){
		int a = 0;
		for (int i = 0; i < 8; i++) {
			for (int j = 1; j < 8; j++) {
				cin >> c;
				if (c == '1')
				{
					l[a].x = i;
					l[a].y = j;
					a++;
				}
				if (cin.eof()) {
					break;
				}
			}
		}
		for (int i = 0; i < 4; i++)
		{
			cout << l[i].x << l[i].y << endl;
		}
		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;
	}
	cin >> c;
	return 0;
}

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

char s[15][15];

char solve(int i,int j){
	if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i][j+1]=='1'&&s[i+1][j+1]=='1'){
		return 'A';
	}
	if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1'){
		return 'B';
	}
	if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1'){
		return 'C';
	}
	if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='1'){
		return 'E';
	}
	if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1'){
		return 'F';
	}
	if(j>0){
		if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i+2][j-1]=='1'){
			return 'D';
		}
		if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i][j+1]=='1'){
			return 'G';
		}
	}
	return 0;
}


int main(){

	
	
	while(!cin.eof()){
		
		for(int i=0;i<15;i++){
			for(int j=0;j<15;j++){
				s[i][j]='0';
			}
		}
		for(int i=0;i<8;i++){
			cin>>s[i];
		}
		char ans;
		bool solved=true;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j]!='1')continue;
				if(solved){
					ans=solve(i,j);
					cout<<ans<<endl;
					solved=false;
				}
			}
		}
	}
	
	
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	char ans = '0', wk;
	int F[16][16];
	while(cin >> wk)
	{
		F[0][0] = wk - '0';
		ans = '0';

		for(int i = 0; i < 8; i++)
		{
			for(int j = 0; j < 8; j++)
			{
				if(i == 0 && j == 0)
					continue;
				cin >> wk;
				F[i][j] = wk - '0';
			}
		}

		for(int i = 0; i < 8; i++)
		{
			for(int j = 0; j < 8; j++)
			{
				if(F[i][j] && F[i][j+1] && F[i+1][j] && F[i+1][j+1])
				{
					ans = 'A';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+2][j] && F[i+3][j])
				{
					ans = 'B';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i][j+2] && F[i][j+3])
				{
					ans = 'C';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+1][j-1] && F[i+2][j-1])
				{
					ans = 'D';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i+1][j+1] && F[i+1][j+2])
				{
					ans = 'E';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+1][j+1] && F[i+2][j+1])
				{
					ans = 'F';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i-1][j+1] && F[i-1][j+2])
				{
					ans = 'G';
					break;
				}
			}
			if(ans != '0')
			{
				break;
			}
		}

		cout << ans << endl;
	}
}