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 <string>

using namespace std;

string func(char a[10][10], int s, int t)
{
	if(s+1 < 8 && t+1 < 8){
		if(a[s][t+1]=='1' && a[s+1][t+1]=='1' && a[s+1][t]=='1'){
			return "A";
		}
	}
	if(s+3 < 8){
		if(a[s+1][t]=='1' && a[s+2][t]=='1' && a[s+3][t]=='1'){
			return "B";
		}
	}
	if(t+3 < 8){
		if(a[s][t+1]=='1' && a[s][t+2]=='1' && a[s][t+3]=='1'){
			return "C";
		}
	}
	if(s+2 < 8 && t-1 >= 0){
		if(a[s+1][t]=='1' && a[s+1][t-1]=='1' && a[s+2][t-1]=='1'){
			return "D";
		}
	}
	if(s+1 < 8 && t+2 < 8){
		if(a[s][t+1]=='1' && a[s+1][t+1]=='1' && a[s+1][t+2]=='1'){
			return "E";
		}
	}
	if(s+2 < 8 && t+1 < 8){
		if(a[s+1][t]=='1' && a[s+1][t+1]=='1' && a[s+2][t+1]=='1'){
			return "F";
		}
	}
	
	return "G";
}

int main()
{
	char a[10][10];
	
	while(cin >> a[0]){
		for(int i = 1; i < 8; i++){
			cin >> a[i];
		}
		bool f = false;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(a[i][j] == '1'){
					cout << func(a, i, j) << endl;
					f = true;
					break;
				}
			}
			if(f){
				break;
			}
		}
	}
	
	return 0;
}

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

using namespace std;

int table[12][10];

int main(){
    while (1) {
        char ans;
        ans = 'S';
        for (int i=0; i<12; i++) {
            for (int j=0; j<10; j++) {
                table[i][j] = 0;
            }
        }
//        char line[100];
//        //cin.ignore();
//        cin>>line;
//        //cout<<line<<endl;
//        if (line[0] == EOF) {
//            return 0;
//        }
//        //cout<<"a"<<endl;
//        if (line[0] == '\n') {
//            cout<<"continue"<<endl;
//            continue;
//        }
//        //cout<<"b"<<endl;
//        for (int i=1; i<9; i++) {
//            table[1][i] = atoi(&line[i-1]);
//        }
//        for (int j=2; j<9; j++) {
//            cin.ignore();
//            cin>>line;
//            for (int i=1; i<9; i++) {
//                table[1][i] = atoi(&line[i-1]);
//            }
//        }
        for (int i=0; i<8; i++) {
            string line;
            cin>>line;
            for (int j=1; j<9; j++) {
                table[i+1][j] = (int)(line[j-1]-'0');
            }
        }
        
//        for (int i=1; i<9; i++) {
//            for (int j=1; j<9; j++) {
//                cout<<table[i][j]<<" ";
//            }
//            cout<<endl;
//        }
        
        int i=1,j=1;
        while (1){
            j++;
            if (j > 8) {
                j = 1;
                i++;
            }
            if (table[i][j] == 1) {
                //A
                if (table[i][j+1]==1 && table[i+1][j] == 1 && table[i+1][j+1] == 1) {
                    ans = 'A';
                    break;
                }
                //B
                else if (table[i+1][j] == 1 && table[i+1][j] == 1){
                    ans = 'B';
                    break;
                }
                //C
                else if (table[i][j+1] == 1 && table[i][j+2] == 1){
                    ans = 'C';
                    break;
                }
                //D
                else if (table[i+1][j] == 1 && table[i+1][j-1] == 1){
                    ans = 'D';
                    break;
                }
                //E
                else if (table[i+1][j+2] == 1){
                    ans = 'E';
                    break;
                }
                //F
                else if (table[i+2][j+1] == 1){
                    ans = 'F';
                    break;
                }
                //G
                else if (table[i][j+1] == 1 && table[i+1][j-1] == 1){
                    ans = 'G';
                    break;
                }
            }
        }
        cout<<ans<<endl;
        
        string str;
        cin>>str;
        if (str[0] == EOF) {
            return 0;
        }else if (str[0] == '\n'){
            continue;
        }
    }
}

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

string board[8];

inline bool a(int x, int y){return (0<=x && x<8 && 0<=y && y<8);}

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

void solve(){
  for(int i=0; i<8; i++){
    for(int j=0; j<8; j++){
      if(board[i][j]=='1'){
        for(int k=0; k<7; k++){
          bool flag=true;
          for(int l=0; l<3; l++){
            if(!a(i+p[k][l][0], j+p[k][l][1]))flag=false;
          }
          if(flag){
            bool flag2=true;
            for(int l=0; l<3; l++){
              if(board[i+p[k][l][0]][j+p[k][l][1]]!='1') flag2=false;
            }
            if(flag2){
              char ans='A'+k;
              cout<<ans<<endl;
              return;
            }
            else continue;
          }
          else continue;
        }
      }
    }
  }
}

int main(){
  while(cin>>board[0]){
    for(int i=1; i<8; i++) cin>>board[i];
    solve();
  }
  return 0;
}