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++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (cin >> s) {
		vector<string>v;
		v.push_back(s);
		rep(i, 0, 7) {
			string t; cin >> t;
			v.push_back(t);
		}
		char ans;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (v[i][j] == '1') {
					if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i - 1][j - 1] == '1')ans = 'G';
					goto here;
				}
			}
		}
	here:;
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>

class FIELD {
public:
  FIELD(int w, int h) : m_w(w), m_h(h) {
    m_pData = new char[m_w * m_h];
  }
  FIELD(int w, int h, const char* pc) : m_w(w), m_h(h) {
    m_pData = new char[m_w * m_h];
    for (int y = 0; y < m_h; y++) {
      for (int x = 0; x < m_w; x++) {
        at(x, y) = *(pc + x + y * m_w) == ' ' ? '0' : '1';
      }
    }
  }
  ~FIELD() {
    delete[] m_pData;
  }
  const char& at(int x, int y) const {
    return *(m_pData + x + y * m_w);
  }
  char& at(int x, int y) {
    return *(m_pData + x + y * m_w);
  }
  int GetWidth() const {
    return m_w;
  }
  int GetHeight() const {
    return m_h;
  }
  bool set() {
    for (int y = 0; y < m_h; y++) {
      std::string line;
      std::cin >> line;
      if (std::cin.eof()) {
        return false;
      }
      std::memcpy(m_pData + y * m_w, line.c_str(), m_w);
    }
    return true;
  }
  void echo() const {
    for (int y = 0; y < m_h; y++) {
      for (int x = 0; x < m_w; x++) {
        std::cout << at(x, y);
      }
      std::cout << std::endl;
    }
  }

private:
  int m_w;
  int m_h;

  char* m_pData;
};

static const FIELD patA(2, 2,
  "**"
  "**"
);

static const FIELD patB(1, 4,
  "*"
  "*"
  "*"
  "*"
);

static const FIELD patC(4, 1,
  "****"
);

static const FIELD patD(2, 3,
  " *"
  "**"
  "* "
);

static const FIELD patE(3, 2,
  "** "
  " **"
);

static const FIELD patF(2, 3, 
  "* "
  "**"
  " *"
);

static const FIELD patG(3, 2,
  " **"
  "** "
);

bool matchTemplate_core(const FIELD& src, const FIELD& templ, int x, int y) {

  for (int yy = 0; yy < templ.GetHeight(); yy++) {
    for (int xx = 0; xx < templ.GetWidth(); xx++) {
      if (src.at(x + xx, y + yy) != templ.at(xx, yy)) {
        return false;
      }
    }
  }

  return true;
}

bool matchTemplate(const FIELD& src, const FIELD& templ) {
  int rangeW = src.GetWidth() - templ.GetWidth();
  int rangeH = src.GetHeight() - templ.GetHeight();

  if (rangeW < 0 || rangeH < 0) {
    return false;
  }

  for (int y = 0; y <= rangeH; y++) {
    for (int x = 0; x <= rangeW; x++) {
      if (matchTemplate_core(src, templ, x, y)) {
        return true;
      }
    }
  }

  return false;
}

int main(void)
{
  FIELD f(8, 8);

  while (f.set()) {
    if (matchTemplate(f, patA)) std::cout << 'A' << std::endl;
    if (matchTemplate(f, patB)) std::cout << 'B' << std::endl;
    if (matchTemplate(f, patC)) std::cout << 'C' << std::endl;
    if (matchTemplate(f, patD)) std::cout << 'D' << std::endl;
    if (matchTemplate(f, patE)) std::cout << 'E' << std::endl;
    if (matchTemplate(f, patF)) std::cout << 'F' << std::endl;
    if (matchTemplate(f, patG)) std::cout << 'G' << std::endl;
  }

  return 0;
}

C++: #include <stdio.h>

int main() {
        const int N = 8;
        char mass[N][N + 1];

        while (scanf("%8s", &mass[0]) != EOF) {
                for (int i = 1; i < N; i++) {
                        scanf("%8s", &mass[i]);
                }
                int a, b;
                bool isFind = false;
                for (a = 0; a < N; a++) {
                        for (b = 0; b < N; b++) {
                                if (mass[a][b] == '1') {
                                        isFind = true;
                                        break;
                                }
                        }
                        if (isFind) {
                                break;
                        }
                }
                char ans;
                if (mass[a][b + 1] == '1' && mass[a + 1][b] == '1' &&
                                mass[a + 1][b + 1] == '1') {
                        ans = 'A';
                } else if (mass[a + 1][b] == '1' && mass[a + 2][b] == '1') {
                        ans = 'B';
                } else if (mass[a][b + 1] == '1' && mass[a][b + 2] == '1') {
                        ans = 'C';
                } else if (mass[a + 1][b - 1] == '1' && mass[a + 1][b] == '1') {
                        if (mass[a + 2][b - 1] == '1') {
                                ans = 'D';
                        } else {
                                ans = 'G';
                        }
                } else if (mass[a][b + 1] == '1' && mass[a + 1][b + 1] == '1') {
                        ans = 'E';
                } else if (mass[a + 1][b] == '1' && mass[a + 1][b + 1] == '1') {
                        ans = 'F';
                }
                printf("%c\n", ans);
        }

        return 0;
}