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 < 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<string>
#include<vector>
#define MAX 7
using namespace std;

int main(void){
  vector<vector<char> > inp(8,vector<char>(8));
  vector<vector<int> > buf(8,vector<int>(8));
  while(cin>>inp[0][0]){
    buf[0][0]=inp[0][0]-'0';
    for(int i = 1 ; i < 8 ; i ++){
      cin>>inp[0][i];
      buf[0][i]=inp[0][i]-'0';
    }
    for(int i = 1 ; i < 8 ; i ++)
      for(int j = 0 ; j < 8 ; j ++){
        cin>>inp[i][j];
        buf[i][j]=inp[i][j]-'0'; 
      }
//cout<<buf[0][3]<<" "<<buf[0][6]<<endl;
    
    bool find=false;
    char ans;
    for(int i = 0 ; i < 8 ; i ++){
      if(find)break;
      for(int j = 0 ; j < 8 ; j ++){
        if(buf[i][j]){
          ans='O';
          if(0<=i&&i<=MAX-1 && 0<=j&&j<=MAX-1&&buf[i+1][j]&&buf[i][j+1]&&buf[i+1][j+1])ans='A';
          else if(0<=i&&i<=MAX-3 && 0<=j&&j<=MAX&&buf[i+3][j])ans='B';
          else if(0<=i&&i<=MAX && 0<=j&&j<=MAX-3&&buf[i][j+3])ans='C';
          else if(0+1<=i&&i<=MAX-1 && 0<=j&&j<=MAX-2&&buf[i-1][j+2])ans='D';
          else if(0<=i&&i<=MAX-1 && 0<=j&&j<=MAX-2&&buf[i+1][j+2])ans='E';
          else if(0<=i&&i<=MAX-2 && 0<=j&&j<=MAX-1&&buf[i+2][j+1])ans='F';
          else if(0+1<=i&&i<=MAX-1 && 0<=j&&j<=MAX-1&&buf[i][j+1]&&buf[i+1][j-1])ans='G';
          find = true;
          break;
        } 
      }
    }
    cout<<ans<<endl;
    
  }
}

C++: #include<cstdio>

using namespace std;

int main(void){
	char in[12][12],data[10];
	int i,j,flag=0,out=0,y,x;

	for(i=0;i<12;i++){
		for(j=0;j<12;j++){
			in[i][j]='0';
		}
	}

	while(1){
		for(i=2;i<10;i++){
			if(scanf("%s",data)==EOF)	flag=1;
			if(flag==1)	break;
			for(j=0;j<8;j++){
				in[i][j+2]=data[j];
			}
		}
		if(flag==1)	break;

		for(i=2;i<10;i++){
			for(j=2;j<10;j++){
				if(in[i][j]=='1'){
					y=i;
					x=j;
					out=1;
					break;
				}
			}
			if(out==1)	break;
		}
		out=0;

		if(in[y][x+1]=='1' && in[y+1][x]=='1' && in[y+1][x+1]=='1')	printf("A\n");
		if(in[y+1][x]=='1' && in[y+2][x]=='1' && in[y+3][x]=='1')	printf("B\n");
		if(in[y][x+1]=='1' && in[y][x+2]=='1' && in[y][x+3]=='1')	printf("C\n");
		if(in[y+1][x-1]=='1' && in[y+1][x]=='1' && in[y+2][x-1]=='1')	printf("D\n");
		if(in[y][x+1]=='1' && in[y+1][x+1]=='1' && in[y+1][x+2]=='1')	printf("E\n");
		if(in[y+1][x]=='1' && in[y+1][x+1]=='1' && in[y+2][x+1]=='1')	printf("F\n");
		if(in[y][x+1]=='1' && in[y+1][x-1]=='1' && in[y+1][x]=='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 <stdio.h>
int main() {
    char RB[8][9],i,j;while (scanf("%s",&RB[0])!=EOF) {for (i=1;i<8;scanf("%s",&RB[i++]));
        for (i=0;i<8;i++) for (j=0;j<8;j++) if (RB[i][j]=='1') {if (j<=4 && RB[i][j+1]=='1' && RB[i][j+2]=='1' && RB[i][j+3]=='1') puts("C"); else if (i<=4 && RB[i+1][j]=='1' && RB[i+2][j]=='1' && RB[i+3][j]=='1') puts("B"); else if (i<7 && j<7 && RB[i+1][j]=='1' && RB[i][j+1]=='1' && RB[i+1][j+1]=='1') puts("A");
        else if (i<6 && RB[i+2][j-1]=='1') puts("D"); else if (RB[i+1][j-1]=='1') puts("G"); else if (j<6 && RB[i+1][j+2]=='1') puts("E"); else puts("F"); i=10,j=10;}}return 0;}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int cnt=0,x,y;
	while(true){
		char masu[8][8];
		cnt=0;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				cin>>masu[i][j];
				if(masu[i][j]=='1'&&cnt==0){
					x=i,y=j;
					cnt++;
				}
			}
		}
		if(masu[x][y+1]=='1'){
			if(masu[x][y+2]=='1'){
				cout<<"C"<<endl;
			}else if(masu[x+1][y]=='0'){
				cout<<"E"<<endl;
			}else if(masu[x+1][y+1]=='0'){
				cout<<"G"<<endl;
			}else{
				cout<<"A"<<endl;
			}
		}else{
			if(masu[x+1][y-1]=='1'){
				cout<<"D"<<endl;
			}else if(masu[x+1][y+1]=='1'){
				cout<<"F"<<endl;
			}else{
				cout<<"B"<<endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

typedef struct _XY {
	int x;
	int y;
} XY;

XY figure[][4] = {
	{{1, 0}, {0, 1}, {1, 1}}, // A
	{{0, 1}, {0, 2}, {0, 3}}, // B
	{{1, 0}, {2, 0}, {3, 0}}, // C
	{{0, 1}, {-1, 1}, {-1, 2}}, // D
	{{1, 0}, {1, 1}, {2, 1}}, // E
	{{0, 1}, {1, 1}, {1, 2}}, // F
	{{1, 0}, {0, 1}, {-1, 1}}, // G
};

string name[7] = {"A", "B", "C", "D", "E", "F", "G"};
int main() {
	int math[8][8];
	char c;
	while (1) {
		memset(math, 0, sizeof(math));
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				c = getchar();
				math[i][j] = c - '0';
			}
			c = getchar();
		}

//		for (int i = 0; i < 8; i++) {
//			for (int j = 0; j < 8; j++) {
//				cout << math[i][j];
//			}
//			cout << endl;
//		}

		XY p;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (math[i][j] == 1) {
					p.x = j;
					p.y = i;
					goto END;
				}
			}
		}

END:
		for (int i = 0; i < 7; i++) {
			if (math[p.y + figure[i][0].y][p.x + figure[i][0].x] == 1 &&
				math[p.y + figure[i][1].y][p.x + figure[i][1].x] == 1 &&
				math[p.y + figure[i][2].y][p.x + figure[i][2].x] == 1 ) {
				cout << name[i] << endl;
				break;
			}
		}

		c = getchar();
		if (c == EOF)
			break;
	}
	return 0;
}