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 <vector>
#include <string>
using namespace std;

string field[8];

bool ch(int i,int j)
{
	if(field[i][j] == '1') return true;
	return false;
}

bool Check_A(int i,int j)
{
	if(i+1 < 8 && j+1 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j+1))  return true;
	}
	return false;
}

bool Check_B(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i+3,j)) return true;
	}
	return false;
}

bool Check_C(int i,int j)
{
	if(j+1 < 8 && j+2 < 8 && j+3 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i,j+2) && ch(i,j+1)) return true;
	}
	return false;
}

bool Check_D(int i,int j)
{
	if(j-1 > 0 && i+1 < 8 && i+2 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i,j-1)) return true;
	}
	return false;
}

bool Check_E(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j+2 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i+1,j+1) && ch(i+1,j+2)) return true;
	}
	return false;
}

bool Check_F(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i+3,j)) return true;
	}
	return false;
}

bool Check_G(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j-1 > 0)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j-1)) return true;
	}
	return false;
}

int main()
{
	while(true)
	{
		if(cin.eof()) break;

		for(int i=0;i<8;i++)
		{
			cin >> field[i];
		}
		
		bool flag = true;
		for(int i=0;i<8;i++)
		{
			for(int j=0;j<8;j++)
			{
				if(Check_A(i,j) && flag)
				{
					cout << "A" << endl;
					flag = false;
				}

				if(Check_B(i,j) && flag)
				{
					cout << "B" << endl;
					flag = false;
				}

				if(Check_C(i,j) && flag)
				{
					cout << "C" << endl;
					flag = false;
				}

				if(Check_D(i,j) && flag)
				{
					cout << "D" << endl;
					flag = false;
				}				

				if(Check_E(i,j) && flag)
				{
					cout << "E" << endl;
					flag = false;
				}

				if(Check_F(i,j) && flag)
				{
					cout << "F" << endl;
					flag = false;
				}

				if(Check_G(i,j) && flag)
				{
					cout << "G" << endl;
					flag = false;
				}
			}
		}
	}
	return 0;
}

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

void Figure(int str[8][8]){
  int i, k;

  for(i = 0;i < 8;i++){
    for(k = 0;k < 8;k++){
      if(str[i][k] == 1){ //1???????????????
	if(str[i][k + 1] == 1){ //?????¢???A,C,E,G?????????
	  if(str[i][k + 2] == 1){ //???????????°C
	    cout << "C" << endl;
	  }else{ //?????????A,E,G
	    if(str[i + 1][k + 1] == 0){ //???????????°G
	      cout << "G" << endl;
	    }else{ // ?????????A,E
	      if(str[i + 1][k] == 1){ //???????????°A
		cout << "A" << endl; //?????????E
	      }else{
		cout << "E" << endl;
	      }
	    }
	  }
	}else{ //?¬?????????¢B,D,F?????¢???
	  if(str[i + 2][k] == 1){ //???????????°B
	    cout << "B" << endl;
	  }else{ //?????????D,F
	    if(str[i + 1][k + 1] == 1){ //???????????°F
	      cout << "F" << endl;
	    }else{ //?????????D
	      cout << "D" << endl;
	    }
	  }
	}
      }
    }
  }
}


int main(){
  int str[8][8], i, k;

  while(scanf("%d", &str[0][0]) != EOF){
    for(i = 0;i < 8;i++){
      for(k = 0;k < 8;k++){
	if(i != 0 && k != 0){
	  cin >> str[i][k];
	}
      }
    }
    Figure(str);
  }

  return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

int main(){
	string s[8];
	while(true){
		bool end = false;
		for(int i=0;i<8;i++){
			if(!(cin >> s[i])) end = true;
		}
		if(end) break;
		for(int i=0;i<8&&!end;i++){
			for(int j=0;j<8&&!end;j++){
				if(s[i][j]=='1'){
					if(i+3<8&&s[i+3][j]=='1') cout << "B" << endl;
					else if(j+3<8&&s[i][j+3]=='1') cout << "C" << endl;
					else if(i+2<8&&0<=j-1&&s[i+2][j-1]=='1') cout << "D" << endl;
					else if(i+1<8&&j+2<8&&s[i+1][j+2]=='1') cout << "E" << endl;
					else if(i+2<8&&j+1<8&&s[i+2][j+1]=='1') cout << "F" << endl;
					else if(i+1<8&&0<=j-1&&s[i+1][j-1]=='1') cout << "G" << endl;
					else cout << "A" << endl;
					end = true;
				}
			}
		}
	}
}

C++: #include<iostream>
#include<vector>
int main(){
	std::vector<std::vector<int> > vec(8,std::vector<int>(8));
	while(1){
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				std::cin>>vec[i][j];
			}
		}
		if(std::cin.eof())break;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(vec[i][j]==1){
					if(vec[i][j+1]==1&&vec[i+1][j]==1&&vec[i+1][j+1]==1)std::cout<<"A"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+2][j]==1&&vec[i+3][j]==1)std::cout<<"B"<<std::endl;
					if(vec[i][j+1]==1&&vec[i][j+2]==1&&vec[i][j+3]==1)std::cout<<"C"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+1][j-1]==1&&vec[i+2][j]==1)std::cout<<"D"<<std::endl;
					if(vec[i][j+1]==1&&vec[i+1][j+1]==1&&vec[i+1][j+2]==1)std::cout<<"E"<<std::endl;
					if(vec[i+1][j+1]==1&&vec[i+1][j+1]==1&&vec[i+2][j+1]==1)std::cout<<"F"<<std::endl;
					if(vec[i][j+1]==1&&vec[i+1][j]==1&&vec[i+1][j-1]==1)std::cout<<"G"<<std::endl;
				}
			}
		}
	}
	return 0;
}