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 <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[9];
	int count = 0;
	while(getline(cin, field1[0])){
		if(count == 0){
			for(int i = 1;i < 8;i++){
				getline(cin, field1[i]);
			}
		}
		if(count != 0){
			for(int i = 1;i < 9;i++){
				getline(cin, field1[i]);
			}
		}
		if(count == 0){	
			for(int i = 0;i < 8;i++){
				for(int j = 0;j < 8;j++){
					if(field1[i][j] == '1') field[i][j] = 1;
					else field[i][j] = 0;
				}
			}
		}
		if(count != 0){
			for(int i = 1;i < 9;i++){
				for(int j = 0;j < 8;j++){
					if(field1[i][j] == '1') field[i-1][j] = 1;
					else field[i-1][j] = 0;
				}
			}
		}
		/*for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				cout << field[i][j];
			}
			cout << endl;
		}
		cout << endl;*/
		for(int i = 0;i < 8;i++){
			int flag = 0;
			for(int j = 0;j < 8;j++){
				if(field[i][j] == 1){
					//cout << i << j <<endl;
					if(field[i][j] == field[i][j+1]){
						if(field[i][j] == field[i+1][j]){
							if(field[i][j] == field[i+1][j+1]){
								cout << "A" << endl;
								flag = 1;break;
							}
							else if(field[i][j] == field[i+1][j-1]){
								cout << "G" << endl;
								flag = 1;break;
							}
						}
						else if(field[i][j] == field[i][j+2] && field[i][j] == field[i][j+3]){
							cout << "C" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+1][j+2]){
							cout << "E" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j]){
						if(field[i][j] == field[i+1][j-1] && field[i][j] == field[i+2][j-1]){
							cout << "D" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+2][j+1]){
							cout << "F" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j] && field[i][j] == field[i+2][j] && field[i][j] == field[i+3][j]){
						cout << "B" << endl;
						flag = 1;break;
					}
				}
			}
			if(flag == 1) break;
		}
		count++;
	}

	return 0;
}

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

#define SAFE_DELETE( x ) { if ( x ){ delete x; x = NULL; } }
#define SAFE_DELETE_ARRAY( x ) { if ( x ){ delete[] x; x = NULL; } }

struct tCell{
	tCell() : board( NULL ), prev( NULL ), next( NULL ){}

	int* board;
	tCell *prev, *next;
};

class MyArray{
public:
	MyArray() : mSize( 0 ), head( NULL ), tail( NULL ){
		head = new tCell;
		tail = new tCell;
		head->next = tail;
		tail->prev = head;
	}
	~MyArray(){
		for ( int i = mSize; i > 0; --i ){
			tCell* cell = tail->prev;
			SAFE_DELETE_ARRAY( cell->board );
			cell->prev->next = cell->next;
			cell->next->prev = cell->prev;
			SAFE_DELETE( cell );
		}
		SAFE_DELETE( tail );
		SAFE_DELETE( head );
	}

	void pushBack( int* b ){
		++mSize;
		tCell* cell = new tCell;
		cell->board = b;
		cell->prev = tail->prev;
		cell->next = tail;
		cell->prev->next = cell;
		cell->next->prev = cell;
	}
	int size(){ return mSize; }

	tCell operator[]( int d ){
		tCell* cell = head->next;
		if ( d >= mSize ){
			cell = NULL;
			return *cell;
		}
		for ( int i = 0; i < d; ++i ){
			cell = cell->next;
		}
		return *cell;
	}

private:
	int mSize;
	tCell *head, *tail;
};

string checkModel( int* b ){
	string model;
	bool find = false;
	int x = 0, y = 0;
	for ( y = 0; y < 10; ++y ){
		for ( x = 0; x < 10; ++x ){
			if( b[ y*10 + x ] ){
				find = true;
				break;
			}
		} if ( find ) break;
	}

	if ( b[ y*10 + ( x+1 ) ] ){	//model A, C, E, G
		if ( b[ y*10 + ( x+2 ) ] ){	//model C
			model = "C";
		}else if ( b[ ( y+1 )*10 + ( x-1 ) ] ){	//model G
			model = "G";
		}else if ( b[ ( y+1 )*10 + ( x+2 ) ] ){	//model E
			model = "E";
		}else{	//model A
			model = "A";
		}
	}else{	//model B, D, F
		if ( b[ ( y+2 )*10 + x ] ){	//model B
			model = "B";
		}else if ( b[ (y+2)*10 + ( x-1 ) ] ){	//model D
			model = "D";
		}else{	//model F
			model = "F";
		}
	}

	return model;
}

int main(){
	bool first = true;
	int cnt = 0;
	int* board;
	string s;
	MyArray ma;

	while ( cin >> s ){
		if( first ){
			board = new int[ 10 * 10 ];
			for ( int i = 0; i < 10*10; ++i ){
				board[ i ] = 0;
			}
			cnt = 0;
			first = false;
		}
		for ( int i = 0; i < 8; ++i ){
			board[ (cnt+1)*10 + i+1 ] = static_cast< int >( s[ i ] - '0' );
		}

		++cnt;
		if ( cnt == 8 ){
			ma.pushBack( board );
			board = NULL;
			first = true;
		}
	}

	for ( int i = 0; i < ma.size(); ++i ){
		cout << checkModel( ma[ i ].board ) << endl;
	}

	return 0;
}

C++: #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 << 'C';
		cout << endl;
	}
}