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
}

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			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 <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string mass[8];

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

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;

        rep(i, 8) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}

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

int main() {
	char zu[8][8];

	while (cin >> zu[0]) {
		for (int i = 1;i < 8;i++)cin >> zu[i];

		int a, b;
		for (int i = 0;i < 8;i++) {
			for (int j = 0;j < 8;j++) {
				if (zu[i][j] == '1') {
					a = i;
					b = j;
					goto FIN;
				}
			}
		}
		FIN:

		if (a<=6&&b<=6&&zu[a][b] == zu[a][b + 1] &&zu[a][b]== zu[a + 1][b] &&zu[a][b]== zu[a + 1][b + 1])cout << 'A' << endl;
		else if (a<=4&&zu[a][b] == zu[a + 1][b]&&zu[a][b] == zu[a + 2][b] && zu[a][b] == zu[a + 3][b])cout << 'B' << endl;
		else if (b <= 4 && zu[a][b] == zu[a][b + 1] && zu[a][b] == zu[a][b + 2] && zu[a][b] == zu[a][b + 3])cout << 'C' << endl;
		else if (b >= 1 && a <= 5 && zu[a][b]== zu[a + 1][b] && zu[a][b] == zu[a + 1][b - 1] && zu[a][b] == zu[a + 2][b - 1])cout << 'D' << endl;
		else if (b <= 5 && zu[a][b] == zu[a][b + 1] && zu[a][b] == zu[a + 1][b + 1] && zu[a][b] == zu[a + 1][b + 2])cout << 'E' << endl;
		else if (a <= 5 && zu[a][b] == zu[a + 1][b] && zu[a][b] == zu[a + 1][b + 1] && zu[a][b] == zu[a + 2][b + 1])cout << 'F' << endl;
		else cout << 'G' << endl;
	}
	return 0;
}

C++: #include <iostream>
main(){int b[20],s,t,x,y,i;char l[8],a;for(;;){for(i=0;i<20;i++)b[i]=0;s=t=9;for(y=0;y<8;y++){if(!(std::cin>>l))break;for(x=0;x<8;x++){if(l[x]==49){if(t==9){s=x-1;t=y;}b[x-s+(y-t)*5]=1;}}}if(y<8)break;a=65;if(b[16])a=66;if(b[4])a=67;if(b[10])a=68;if(b[8])a=69;if(b[12])a=70;if(b[5]&&b[2])a=71;std::cout<<a<<"\n";}}

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

using namespace std;

string s[8];

int check( int i , int j ){

  if( i + 1 < 8 && j + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j] == '1' ){
      return 1;
    }
  }
  if( i + 3 < 8 ){
    if( s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1' ){
      return 2;
    }
  }
  if( j + 3 < 8 ){
    if( s[i][j+1] == '1' && s[i][j+2] == '1' && s[i][j+3] == '1' ){
      return 3;
    }
  }
 if( j - i > 0 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j-1] == '1' && s[i+1][j-2] == '1' ){
      return 4;
    }
  }
 if( j + 2 < 8 && i + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1' ){
      return 5;
    }
  }
  if( j + 1 < 8 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1' ){
      return 6;
    }
  }
  return 7;
}

int main(void){
  
  while( cin >> s[0] ){

    for( int i = 1 ; i < 8 ; i++ ){
	cin >> s[i];
    }

    for( int i = 0 ; i < 8 ; i++ ){
      for( int j = 0 ; j < 8 ; j++ ){
	if( s[i][j] == '1' ){
	  // cout << check( i , j ) << "---" <<  endl;
	  switch( check( i , j ) ){
	  case 1:
	    cout << "A" << endl;
	    break;
	  case 2:
	    cout << "B" << endl;
	    break;
	  case 3:
	    cout << "C" << endl;
	    break;
	  case 4:
	    cout << "D" << endl;
	    break;
	  case 5:
	    cout << "E" << endl;
	    break;
	  case 6:
	    cout << "F" << endl;
	    break;
	  case 7:
	    cout << "G" << endl;
	    break;
	  }
	  goto end;
	}
      }
    }
   end:;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int xb[7][3] = {
	{1, 0, 1},
	{0, 0, 0},
	{1, 2, 3},
	{0, -1, -1},
	{1, 1, 2},
	{0, 1, 1},
	{1, 0, -1}
};

int yb[7][3] = {
	{0, 1, 1},
	{1, 2, 3},
	{0, 0, 0},
	{1, 1, 2},
	{0, 1, 1},
	{1, 1, 2},
	{0, 1, 1}
};

int main() {
	string field[8];
	while(getline(cin, field[0])) {
		for(int i = 1; i < 8; i++) getline(cin, field[i]);

		char ans = '\0';
		rep(y,8) {
			rep(x,8) {
				if(field[y][x] == '1') {
					// cerr << "x: " << x << " " << "y: " << y << endl;
					rep(i,8) {
						bool f = true;
						rep(j,3) {
							int nx = xb[i][j];
							int ny = yb[i][j];
#if 0
							if(0 <= nx && nx < 8 && 0 <= ny && ny < 8) {
								if(field[y+ny][x+nx] != '1') {
									f = false;
									break;
								}
							}	
#endif
						}
						if(f) {
							ans = 'A' + i;
							goto END;
						}
					}
				}
			}
		}
	END:
		cout << ans << endl;
		getline(cin, field[0]);
	}
	return 0;
}