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

int field[8][8];

bool WithinRange(int y, int x) {
  if (x < 0) return false;
  if (x >= 8) return false;
  if (y < 0) return false;
  if (y >= 8) return false;

  return true;
}

int main() {
  while (1) {
    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        char c;
        if (scanf(" %c", &c) != 1) return 0;
        field[i][j] = (c == '1');
      }
    }

    bool has_decided = false;
    for (int i=0; i<7; i++) {
      for (int j=0; j<7; j++) {
        int sum = 0;
        for (int p=0; p<2; p++) {
          for (int q=0; q<2; q++) {
            sum += field[i+p][j+q];
          }
        }

        if (sum == 4 && !has_decided) {
          puts("A");
          has_decided = true;
        }
      }
    }

    if (has_decided) continue;

    for (int i=0; i<7; i++) {
      for (int j=0; j<4; j++) {
        int sum = 0;
        for (int k=0; k<4; k++) {
          sum += field[i][j+k];
        }

        if (sum == 4 && !has_decided) {
          puts("C");
          has_decided = true;
        }
      }
    }
    if (has_decided) continue;

    for (int j=0; j<7; j++) {
      for (int i=0; i<4; i++) {
        int sum = 0;
        for (int k=0; k<4; k++) {
          sum += field[i+k][j];
        }

        if (sum == 4 && !has_decided) {
          puts("B");
          has_decided = true;
        }
      }
    }
    if (has_decided) continue;

    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        int dx[] = {1, 1, 0, 0};
        int dy[] = {-1, 0, 0, 1};
        int sum = 0;

        for (int k=0; k<4; k++) {
          int newy = i+dy[k];
          int newx = j+dx[k];
          if (WithinRange(newy, newx)) sum += field[newy][newx];
        }

        if (sum == 4 && !has_decided) {
          puts("D");
          has_decided = true;
        }
      }
    }
    if (has_decided) continue;
    
    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        int dx[] = {1, 1, 0, 2};
        int dy[] = {1, 0, 0, 1};
        int sum = 0;

        for (int k=0; k<4; k++) {
          int newy = i+dy[k];
          int newx = j+dx[k];
          if (WithinRange(newy, newx)) sum += field[newy][newx];
        }

        if (sum == 4 && !has_decided) {
          puts("E");
          has_decided = true;
        }
      }
    }
    if (has_decided) continue;

    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        int dx[] = {1, 0, 0, 1};
        int dy[] = {1, 1, 0, 2};
        int sum = 0;

        for (int k=0; k<4; k++) {
          int newy = i+dy[k];
          int newx = j+dx[k];
          if (WithinRange(newy, newx)) sum += field[newy][newx];
        }

        if (sum == 4 && !has_decided) {
          puts("F");
          has_decided = true;
        }
      }
    }
    if (has_decided) continue;

    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        int dx[] = {-1, 0, 0, 1};
        int dy[] = {1, 1, 0, 0};
        int sum = 0;

        for (int k=0; k<4; k++) {
          int newy = i+dy[k];
          int newx = j+dx[k];
          if (WithinRange(newy, newx)) sum += field[newy][newx];
        }

        if (sum == 4 && !has_decided) {
          puts("G");
          has_decided = true;
        }
      }
    }
    if (has_decided) continue;
  }
}

C++: #include<stdio.h>

char mas[20][20]={0};

char check(x,y){
  if(mas[y][x+3]=='1'){
    //printf("C\n");
    return 'C';
  }
  if(mas[y+2][x+1]=='1'){
    //printf("F\n");
    return 'F';
  }
  
  if(x>0){
    if(mas[y+2][x-1]=='1'){
      //printf("D\n");
      return 'D';
    }
  }
  

  if(mas[y+3][x]=='1'){
    //printf("B\n");
    return 'B';
  }

  if(mas[y][x+1]=='1'){
    if(mas[y+1][x+2]=='1'){
      //printf("E\n");
      return 'E';
    }
    if(x>0){
      if(mas[y+1][x-1]=='1'){
	//printf("G\n");
	return 'G';
      }
    }
    if(mas[y+1][x]=='1'){
      //printf("A\n");
      return 'A';
    }
  }
  // printf("NA");
}

main(){
  int i,j;
  int f,x,y;
  char ans;
  while(scanf("%s",mas[0])!=EOF){

    f=0;

    for(j=0;j<8;j++){
      if(mas[0][j]=='1' && f==0){
	x=j;
	y=0;
	f=1;
      }
    }

    for(i=1;i<8;i++){
      scanf("%s",mas[i]);
      for(j=0;j<8;j++){
	if(mas[i][j]=='1' && f==0){
	  x=j;
	  y=i;
	  f=1;
	}
      }
    }
    printf("%c\n",check(x,y));
  }
  return 0;
}

C++: #include <cstdio>

using namespace std;

char map[8][8];

void check(void);

int main()
{
	while (scanf(" %c", &map[0][0]) != EOF){
		for (int i = 1; i < 8; i++){
			scanf(" %c", &map[0][i]);
		}
		
		for (int i = 1; i < 8; i++){
			for (int j = 0; j < 8; j++){
				scanf(" %c", &map[i][j]);
			}
		}
		
		check();
	}
	
	return (0);
}

void check(void)
{
	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++){
			if (map[i][j] == '1'){
				if (map[i][j + 1] == '1' && map[i + 1][j] == '1' && map[i + 1][j + 1] == '1'){
					puts("A");
				}
				else if (map[i + 1][j] == '1' && map[i + 2][j] == '1' && map[i + 3][j] == '1'){
					puts("B");
				}
				else if (map[i][j + 1] == '1' && map[i][j + 2] == '1' && map[i][j + 3] == '1'){
					puts("C");
				}
				else if (map[i + 1][j] == '1' && map[i + 1][j - 1] == '1' && map[i + 2][j - 1] == '1'){
					puts("D");
				}
				else if (map[i][j + 1] == '1' && map[i + 1][j + 1] == '1' && map[i + 1][j + 2] == '1'){
					puts("E");
				}
				else if (map[i + 1][j] == '1' && map[i + 1][j + 1] == '1' && map[i + 2][j + 1] == '1'){
					puts("F");
				}
				else if (map[i][j + 1] == '1' && map[i + 1][j] == '1' && map[i + 1][j - 1] == '1'){
					puts("G");
				}
			}
		}
	}
}