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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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++: //0036
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	while (!cin.eof()) {
		char c[8][8];
		for (int i = 0; i < 8; i++)
			for (int j = 0; j < 8; j++)
				cin >> c[i][j];
		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;
	}
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (!cin.eof()) {
		for (int i = 0; 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' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1]) {
			if (map[y][x + 1] && map[y + 1][x]) {
				cout << "A";
			} 
			if (map[y + 2][x + 1] && map[y + 1][x]) {
				cout << "F";
			}
			if (map[y + 1][x + 2] && map[y][x + 1]) {
				cout << "E";
			}
		}
		if (map[y - 1][x - 1]) {
			if (map[y][x + 1] && map[y + 1][x]) {
				cout << "G";
			}
			if (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;
}

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

#define SIZE 8

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

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

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

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

int main(){
    while(1){
        vector<string> v(8);
        int sx=8,sy=8,ex=-1,ey=-1;
        for(int i=0; i<8; i++){
            if(!(cin>>v[i])) goto end;
            for(int j=0; j<8; j++){
                if(v[i][j]=='1'){
                    sx=min(sx,j);
                    sy=min(sy,i);
                    ex=max(ex,j);
                    ey=max(ey,i);
                }
            }
        }
        char ans;
        if(sx==ex) ans='B';
        else if(sy==ey) ans='C';
        else if(ex-sx==1&&ey-sy==1) ans='A';
        else if(v[ey][ex]=='0'&&ex-sx==1) ans='G';
        else if(v[ey][ey]=='0'&&ex-sy==2) ans='D';
        else if(ex-sx==2) ans='E';
        else ans='F';
        cout<<ans<<endl;
    }
 end:;
}

C++: #include <iostream>
#include <string>
using namespace std;
string s[8];
char f(){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]=='1'){
				if(i<5)
					if(s[i+3][j]=='1')return 'B';
				if(j<5)
					if(s[i][j+3]=='1')return 'C';
				if(i<6&&j>0)
					if(s[i+2][j-1]=='1')return 'D';
				if(i<7&&j<6)
					if(s[i+1][j+2]=='1')return 'E';
				if(i<6&&j<7)
					if(s[i+2][j+1]=='1')return 'F';
				if(i<7&&j>0)
					if(s[i+1][j-1]=='1'&&s[i][j+1])return 'G';
				return 'A';
			}
		}
	}
}

int main(){
	while(cin>>s[0]){
		for(int i=1;i<8;i++)cin>>s[i];
		cout <<f() <<endl;
	}
	return 0;
}

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

int main(){
    while(1){
        vector<string> v(8);
        int sx=8,sy=8,ex=-1,ey=-1;
        for(int i=0; i<8; i++){
            if(!(cin>>v[i])) goto end;
            for(int j=0; j<8; j++){
                if(v[i][j]=='1'){
                    sx=min(sx,j);
                    sy=min(sy,i);
                    ex=max(ex,j);
                    ey=max(ey,i);
                }
            }
        }
        char ans;
        if(sx==ex) ans='B';
        else if(sy==ey) ans='C';
        else if(ex-sx==1&&ey-sy==1) ans='A';
        else if(v[sy][sx]=='0'&&ex-sx==1) ans='G';
        else if(v[sy][ex]=='0'&&ex-sx==2) ans='D';
        else if(ex-sx==2) ans='E';
        else ans='F';
        cout<<ans<<endl;
    }
 end:;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i) = 0;(i)<(n);(i)++)
#define pb push_back
#define mp make_pair
#define All(X) X.begin(),X.end()

int main(){
	vector<int> vx, vy;
	while (1){
		vx.clear();
		vy.clear();
		REP(i, 8){
			string str;
			cin >> str;
			if (cin.eof()){
				return 0;
			}	
			REP(j, 8){
				if (str[j] == '1'){
					vx.pb(i);
					vy.pb(j);
				}
			}
		}
		char ans = 'G';
		if (vx[0] == vx[1] && vy[0] == vy[2]) ans = 'A';
		if (vy[0] == vy[1] && vy[0] == vy[2] && vy[0] == vy[3]) ans = 'B';
		if (vx[0] == vx[1] && vx[0] == vx[2] && vx[0] == vx[3]) ans = 'C';
		if (vx[1] == vx[2] && vy[1] == vy[3] && vy[0] == vy[2]) ans = 'D';
		if (vx[0] == vx[1] && vx[2] == vx[3] && vy[1] == vy[2] && vy[0] + 2 == vy[3]) ans = 'E';
		if (vx[1] == vx[2] && vy[0] == vy[1] && vy[2] == vy[3]) ans = 'F';
		
		cout << ans << endl;
		
	}
}