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)
	}
}

Python: while True:
	try:
		x=[[int(i) for i in input()] for j in range(8)]
		count=0
		num=[]
		for i in range(8):
			if x[i].count(1)!=0:
				num.append(i)
				count+=1
		if count==1:
			print("C")
		elif count==4:
			print("B")
		elif count==2:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						if x[num[0]+1][j]==1:
							print("A")
						else:
							print("E")
					else:
						if x[num[0]+1][j-1]==1:
							print("G")
						else:
							if x[num[0]+1][j]==1:
								print("A")
							else:
								print("E")
					break
		else:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						print("F")
					else:
						if x[num[0]][j-1]==1:
							print("D")
						else:
							print("F")
					break
		input()
	except EOFError:
		break

Python: while True:
  data = [[0 for _ in range(8)] for _ in range(8)]
  for i in range(8):
    data_in = input()
    for j in range(8):
      data[i][j] = int(data_in[j])
  block = []
  for i in range(8):
    for j in range(8):
      if data[i][j] == 1:
        block.append([i,j])
  piv_x = block[0][0]
  piv_y = block[0][1]
  if block[3][0] == piv_x + 1 and block[3][1] == piv_y + 1:
    print("A")
  elif block[3][0] == piv_x + 3:
    print("B")
  elif block[3][1] == piv_y + 3:
    print("C")
  elif block[3][1] == piv_y - 1 and block[3][0] == piv_x + 2:
    print("D")
  elif block[3][1] == piv_y + 2 and block[3][0] == piv_x + 1:
    print("E")
  elif block[3][1] == piv_y + 1 and block[3][0] == piv_x + 2:
    print("F")
  elif block[3][1] == piv_y and block[3][0] == piv_x + 1:
    print("G")
  try:
    data_in = input()
  except EOFError:
    break

Python: while True:
	try:
		x=[[int(i) for i in input()] for j in range(8)]
		count=0
		num=[]
		for i in range(8):
			if x[i].count(1)!=0:
				num.append(i)
				count+=1
		if count==1:
			print("C")
		elif count==4:
			print("B")
		elif count==2:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						if x[num[0]+1][j]==1:
							print("A")
						else:
							print("E")
					else:
						if x[num[0]+1][j-1]==1:
							print("G")
						else:
							if x[num[0]+1][j]==1:
								print("A")
							else:
								print("E")
					break
		else:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						print("F")
					else:
						if x[num[0]+1][j-1]==1:
							print("D")
						else:
							print("F")
					break
		input()
	except EOFError:
		break

Python: import sys
f = sys.stdin

figures = {'A':['11','11'],
'B':['1','1','1','1'],
'C':['1111'],
'D':['01','11','10'],
'E':['110','011'],
'F':['10','11','01'],
'G':['011','110']}

def figure_in_board(figure, board):
    for i in range(len(board)):
        index = board[i].find(figure[0])
        if index != -1 and i + len(figure) <= len(board):
            for j in range(1, len(figure)):
                if index != board[i + j].find(figure[j]):
                    return False
            return True
    return False

while True:
    board = [f.readline().strip() for _ in range(8)]
    for k, v in figures.items():
        if figure_in_board(v, board):
            print(k)
            break
    
    if f.readline() == '':
        break

Python: while 1:
    try:
        n=[]
        for i in range(8):
            s=input()
            n_s=[]
            for j in s:
                n_s.append(int(j))
            for j in range(3):n_s.append(0)
            n.append(n_s)
        n_s=[0]*11
        for i in range(3):
            n.append(n_s)    
        for i in range(64):
            if n[i//8][i%8]==1:
                break
        p_x=i//8
        p_y=i%8
        if n[p_x][p_y]+n[p_x][p_y+1]+n[p_x+1][p_y]+n[p_x+1][p_y+1]==4:print("A")
        elif n[p_x][p_y]+n[p_x+1][p_y]+n[p_x+2][p_y]+n[p_x+3][p_y]==4:print("B")
        elif n[p_x][p_y]+n[p_x][p_y+1]+n[p_x][p_y+2]+n[p_x][p_y+3]==4:print("C")
        elif n[p_x][p_y]+n[p_x][p_y+1]+n[p_x+1][p_y+1]+n[p_x+1][p_y+2]==4:print("E")
        elif n[p_x][p_y]+n[p_x+1][p_y]+n[p_x+1][p_y+1]+n[p_x+2][p_y+1]==4:print("F")
        else:
            if n[p_x][p_y]+n[p_x+1][p_y-1]+n[p_x+1][p_y]+n[p_x+2][p_y-1]==4:print("D")
            elif n[p_x][p_y]+n[p_x][p_y+1]+n[p_x+1][p_y-1]+n[p_x+1][p_y]==4:print("G")
        s=input()
    except:break

Python: import sys

while True:
	sur = []

	for _ in range(8):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

	try:
		line = input()
	except:
		break

Python: while True:
    try:
        cnt = 0
        for i in range(8):
            inp = input()
            if cnt == 1:
                if inp.count("1") == 1:
                    print("B")
                elif inp.index("1") == ind:
                    print("F")
                else:
                    print("D")
                cnt = -1
            elif cnt == 2:
                if inp.index("1") == ind:
                    print("A")
                elif inp.index("1") == ind + 1:
                    print("E")
                else:
                    print("G")
                cnt = -1
            elif cnt == 4:
                print("C")
                cnt = -1
            elif "1" in inp:
                ind = inp.index("1")
                cnt = inp.count("1")
        inp = input()
    except:
        break