Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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 <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

double dot(P a,P b){return real(conj(a)*b);}
double cross(P a,P b){return imag(conj(a)*b);}

typedef long double Real;

int main(){
  int s;
  while(~scanf("%d",&s)){
    vi x;
    if(s>0)x.push_back(s);
    REPR(i,8){
      scanf("%d",&s);
      if(s>0)x.push_back(s);
    }
    if(x.size()==4){
      puts("B");
    }else if(x.size()==1){
      puts("C");
    }else{
      int a=0,b=0;
      while(x[0]%10==0){
        ++a;
        x[0]/=10;
      }
      while(x[1]%10==0){
        ++b;
        x[1]/=10;
      }
      if(x.size()==3){
        if(a==b){
          puts("D");
        }else{
          puts("F");
        }
      }else{
        if(a==b){
          puts("A");
        }else if(a>b){
          puts("E");
        }else{
          puts("G");
        }
      }
    }
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()


int main(){
    int mod=1000000007;
    int ax, ay;
    char f[12][12];
    bool flag=0;
    for (int i=0;i<12;++i) {
        for (int j=0;j<12;++j) {
            f[i][j]=0;
        }
    }

    for (;;) {
        for (int i=0;i<8;++i) {
            if(scanf("%s",f[i])==EOF) {
                flag=1;
                break;
            }
        }
        if (flag) break;

        for(int i=0;i<64;++i) {
            if (f[i/8][i%8]=='1') {
                ax=i%8;
                ay=i/8;
                break;
            }
        }
        if (f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1') printf("A\n");
        else if (f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1') printf("B\n");
        else if (f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1') printf("C\n");
        else if (f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1') printf("D\n");
        else if (f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1') printf("E\n");
        else if (f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1') printf("F\n");
        else if (f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1') printf("G\n");
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	string s[20];
	while(cin>>s[5]){
		s[5]="00000"+s[5];
		for(int i=6;i<13;i++){
			cin>>s[i];
			s[i]="00000"+s[i];
		}
		for(int i=5;i<13;i++){
			for(int j=5;	j<13;j++){
				if(s[i][j]=='1'){
					if(s[i+1][j+1]=='1'&&s[i+1][j]=='1'&&s[i][j+1]=='1'){cout<<'A'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1'){cout<<'B'<<endl;goto L;}
					if(s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1'){cout<<'C'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i+2][j-1]=='1'){cout<<'D'<<endl;goto L;}
					if(s[i+1][j+1]=='1'&&s[i][j+1]=='1'&&s[i+1][j+2]=='1'){cout<<'E'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1'){cout<<'F'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i][j+1]=='1'){cout<<'G'<<endl;goto L;}
				}
			}
		}L:;
	}
}

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;
    
    while (cin >> mass[0] >> mass[1] >> mass[2] >> mass[3] >> mass[4] >> mass[5] >> mass[6] >> mass[7]) {
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1') {
                    c = solve(i, j);
                    cout << c << endl;
                    goto flag;
                }
            }
        }
        flag:;
    }
    
    return 0;
}