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 <cstdio>

#define rep(i,n) for(int i = 0 ; i < n ;i++ )
using namespace std;

int main(){
 char  ma[8][8];
  while(!cin.eof()){
    rep(i,8){
      rep(j,8){
ma[i][j]='0';
      }
    }
    rep(i,8){
      rep(j,8){
	cin >> ma[i][j];

      }
    }
    rep(i,8){
      rep(j,8){
	if(ma[i][j]=='1'){
	  if(ma[i][j+1] == '1' && ma[i+1][j+1] == '1'&& i+1 < 8&&j+1 < 8 ){
	    cout << 'A' << endl;
	    goto f;
	  }else if(ma[i+3][j] == '1' &&i+3 < 8){
	    cout << 'B' << endl;
	    goto f;
	  }else if(ma[i][j+3] == '1'&& j+3 < 8){
	    cout << 'C' << endl;
	    goto f;
	  }else if(ma[i+3][j-1] == '1' && i+3 < 8 && 0 < j-1){
	    cout << 'D' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1<8 && j+3 < 8){
	    cout << 'E' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1 < 8&& j+3 < 8){
	    cout << 'F' << endl;
	    goto f;
	  }else if(ma[i][j+1] == '1' && ma[i+1][j-1] == '1' && j+1 < 8 && i+1 < 8 && 0<j-1 ){
	    cout << 'G' << endl;
	    goto f;
	  }
	}
      }
    }
  f:
  }
  
  return 0;
}

C++: #include<stdio.h>
int main(){
	int field[8][8];
	int a,b;
	for(;;){
		for(b=0;b<8;b++){
			for(a=0;a<8;a++){if(scanf("%1d",&field[a][b]) == EOF){break;}}
			if(a!=8){break;}
		}
		if(b!=8){break;}
		for(b=0;b<8;b++){
			for(a=0;a<8;a++){
				if(field[a][b] == 1){
					if(field[a][b] == 1 && field[a+1][b] == 1 && field[a][b+1] == 1 && field[a+1][b+1] == 1){printf("A\n");break;}
					else if(field[a][b] == 1 && field[a][b+1] == 1 && field[a][b+2] == 1 && field[a][b+3] == 1){printf("B\n");break;}
					else if(field[a][b] == 1 && field[a+1][b] == 1 && field[a+2][b] == 1 && field[a+3][b] == 1){printf("C\n");break;}
					else if(field[a][b] == 1 && field[a][b+1] == 1 && field[a-1][b+1] == 1 && field[a-1][b+2] == 1){printf("D\n");break;}
					else if(field[a][b] == 1 && field[a+1][b] == 1 && field[a+1][b+1] == 1 && field[a+2][b+1] == 1){printf("E\n");break;}
					else if(field[a][b] == 1 && field[a][b+1] == 1 && field[a+1][b+1] == 1 && field[a+1][b+2] == 1){printf("F\n");break;}
					else if(field[a][b] == 1 && field[a+1][b] == 1 && field[a][b+1] == 1 && field[a-1][b+1] == 1){printf("G\n");break;}
				}
			}
			if(a!=8){break;}
		}
	}
	return 0;
}

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

int main()
{
    while(true){
        int i=0;
        string map[8];
        while(cin>>map[i],!cin.eof()){
            i++;
            if(i==8){
                break;
            }
        }
        if(cin.eof()){
            break;
        }
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(i<7 && j<7){
                    if(map[i][j]=='1' && map[i][j+1]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1'){
                        cout<<'A'<<endl;
                    }
                }
                if(i<5){
                    if(map[i][j]=='1' && map[i+1][j]=='1' && map[i+2][j]=='1' && map[i+3][j]=='1'){
                        cout<<'B'<<endl;
                    }
                }
                if(j<5){
                    if(map[i][j]=='1' && map[i][j+1]=='1' && map[i][j+2]=='1' && map[i][j+3]=='1'){
                        cout<<'C'<<endl;
                    }
                }
                if(j>0 && i<6){
                    if(map[i][j]=='1' && map[i+1][j]=='1' && map[i+1][j-1]=='1' && map[i+2][j-1]=='1'){
                        cout<<'D'<<endl;
                    }
                }
                if(i<7 && j<6){
                    if(map[i][j]=='1' && map[i][j+1]=='1' && map[i+1][j+1]=='1' && map[i+1][j+2]=='1'){
                        cout<<'E'<<endl;
                    }
                }
                if(i<6 && j<7){
                    if(map[i][j]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1' && map[i+2][i+1]=='1'){
                        cout<<'F'<<endl;
                    }
                }
                if(i<7 && j>1){
                    if(map[i][j]=='1' && map[i][j-1]=='1' && map[i+1][j-1]=='1' && map[i+1][j-2]=='1'){
                        cout<<'G'<<endl;
                    }
                }
            }
        }
    }
    return 0;
}

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

int main(){

  char str[11][11];

  
  while(scanf("%s",str[0]) != EOF){
    for(int i=1;i<8;i++){
      scanf("%s",str[i]);
    }
    
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	if(str[i][j]=='1'){
	  if(i<8 && j<8 && str[i][j+1]=='1' && str[i+1][j]=='1' && str[i+1][j+1]=='1'){
	    printf("A\n");
	    goto end;
	  }
	  if(i<6 && str[i+1][j]=='1' && str[i+2][j]=='1' && str[i+3][j]=='1'){
	    printf("B\n");
	    goto end;
	  }
	  if(j<6 && str[i][j+1]=='1' && str[i][j+2]=='1' && str[i][j+3]=='1'){
	    printf("C\n");
	    goto end;
	  }
	  if(i<7 && j>0 && str[i+1][j-1]=='1' && str[i+1][j]=='1' && str[i+2][j-1]=='1'){
	    printf("D\n");
	    goto end;
	  }
	  if(i<8 && j<7 && str[i][j+1]=='1' && str[i+1][j+1]=='1' && str[i+1][j+2]=='1'){
	    printf("E\n");
	    goto end;
	  }
	  if(i<7 && j<8 && str[i+1][j]=='1' && str[i+1][j+1]=='1' && str[i+2][j+1]=='1'){
	    printf("F\n");
	    goto end;
	  }
	  if(i<8 && j<8 && j>0 && str[i][j+1]=='1' && str[i+1][j-1]=='1' && str[i+1][j]=='1'){
	    printf("G\n");
	    goto end;
	  } 
	  
	}
      }
    }
    
  end: int a;
    
  }
  
  return  0;
}