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>
using namespace std;
char c[8][8];
void input() {
	for (int i = 0; i < 8; i++)
		for (int j = 0; j < 8; j++)
			cin >> c[i][j];
}
int main() {
	while (cin){
		input();
		int a, b;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (c[i][j] == '1') {
					a = i;
					b = j;
					goto C;
				}
			}
		}
	C:
		if (c[a][b + 1] == '1') {
			if (c[a + 1][b] == '1') {
				if (c[a + 1][b + 1] == '1')
					cout << 'A';
				else cout << 'G';
			}
			else {
				if (c[a + 1][b + 1] == '1')
					cout << 'E';
				else cout << 'C';
			}
		}
		else if (c[a + 1][b + 1] == '1')
			cout << 'F';
		else if (c[a + 1][b - 1] == '1')
			cout << 'D';
		else cout << 'B';
		cout << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

string fuck(vector<pair<int,int>>&xs) {
  int i0 = INF;
  int j0 = INF;
  int i1 = -INF;
  int j1 = -INF;
  bool zero = false;

  rep (k, 4) {
    int i = car(xs[k]);
    int j = cdr(xs[k]);
    i0 = min(i0, i);
    j0 = min(j0, j);
    i1 = max(i1, i);
    j1 = max(j1, j);
    if (!i && !j) zero = true;
  }

  if (i1 == 3) return "B";
  if (j1 == 3) return "C";
  if (i1 == 1 && j1 == 1) return "A";

  if (i1 == 2) {
    if (zero) return "F";
    return "D";
  }

  if (zero) return "E";
  return "G";
}

int main() {

  loop {
    string ln[8];
    rep (i, 8) cin >> ln[i];

    vector<pair<int,int>> xs;
    int mi = INF;
    int mj = INF;
    rep (i, 8) {
      rep (j, 8) {
        if (ln[i][j] == '1') {
          xs.push_back(cons(i, j));
          mi = min(mi, i);
          mj = min(mj, j);
        }
      }
    }

    rep (i, 4) {
      xs[i] = cons(car(xs[i]) - mi, cdr(xs[i]) - mj);
    }

    cout << fuck(xs) << endl;

    getline(cin, ln[0]);
    if (!cin) break;
  }

  return 0;
}

C++: #include<iostream>

using namespace std;

int main(){

  while(1){

    int data[15][15];
    char in;
    for(int i = 0; i < 15; i++){
      for(int j = 0; j < 15; j++){
	data[i][j] = 0;
      }
    }
    for(int i = 3; i < 11; i++){
      for(int j = 3; j < 11; j++){
	if(cin >> in){
	  if(in == '1'){
	    data[i][j] = 1;
	  }
	}else{
	  return 0;
	}
      }
    }
    int x,y,status = 0;
    
    for(int i = 3; i < 11; i++){
      for(int j = 3; j < 11; j++){
	if(data[i][j] == 1){
	  x = i;
	  y = j;
	  status = 1;
	  break;
	}
      }
      if(status == 1) break;
    }
    
    if(data[x+1][y] == 1 && data[x][y+1] && data[x+1][y+1]) cout << "A" <<endl;
    else if(data[x+1][y] == 1 && data[x+2][y] == 1 && data[x+3][y] == 1) cout << "B" <<endl;
    else if(data[x][y+1] ==1 && data[x][y+2] ==1 &&data[x][y+3] ==1) cout << "C" << endl;
    else if(data[x+1][y] ==1 && data[x+1][y-1] ==1 && data[x+2][y-1] ==1) cout << "D" << endl;
    else if(data[x][y+1] ==1 && data[x+1][y+1] ==1 && data[x+1][y+2] ==1) cout << "E" << endl;
    else if(data[x+1][y] ==1 && data[x+1][y+1] ==1 && data[x+2][y+1] ==1) cout << "F" << endl;
    else if(data[x][y+1] ==1 && data[x+1][y] ==1 && data[x+1][y-1] ==1) cout << "G" << endl;
  }
  return 0;
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (cin >> source[0]) {
		for (int i = 1; i < SIZE; i++) {
			cin >> source[i];
		}

		bool map[14][14] = {false};
		int x = SIZE - 1, y = SIZE - 1;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = (source[i][j] == '1' ? true : false);
				if (source[i][j] == '1') {
					x = min(j, x);
					y = min(i, y);
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "A";
		} 
		if (map[y + 1][x + 1] && map[y + 2][x + 1] && map[y + 1][x]) {
			cout << "F";
		}
		if (map[y + 1][x + 1] && map[y + 1][x + 2] && map[y][x + 1]) {
			cout << "E";
		}
		if (map[y - 1][x - 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "G";
		}
		if (map[y - 1][x - 1] && map[y + 2][x - 1] && map[y + 1][x]) {
			cout << "D";
		}
		if (map[y + 1][x] && map[y + 2][x] && map[y + 3][x]) {
			cout << "B";
		}
		if (map[y][x + 1] && map[y][x + 2] && map[y][x + 3]) {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}