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

Python: if __name__ == '__main__':

	while True:
		try:
			A = []

			for i in range(8):
				tmp = list(map(int,input()))
				if tmp.count(1) > 0:
					A.append(tmp)

			if len(A) == 1:
				print("C")
			elif len(A) == 4:
				print("B")
			else:
				if len(A) == 2:#A,E,G
					if A[0].index(1) < A[1].index(1):
						print("E")
					elif A[0].index(1) > A[1].index(1):
						print("G")
					else:
						print("A")
				elif len(A) == 3:#D,F
					if A[0].index(1) < A[2].index(1):
						print("F")
					else:
						print("D")
			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]][j-1]==1:
							print("D")
						else:
							print("F")
					break
			
	except EOFError:
		break

Python: while True:
    try:
        mat = []
        for i in range(8):
            tmplst = list(input())
            mat.append(tmplst)
        
        a = []

        for j in mat:
            for k, num in enumerate(j):
                if num == '1':
                    a.append(k)

        if a[1] == a[0] +1:
            if a[2] == a[0] -1:
                print("G")
            elif a[2] == a[0]:
                print("A")
            elif a[2] == a[0] +1:
                print("E")
            else:
                print("C")

        else:
            if a[0] == a[3] +1:
                print("D")
            elif a[0] == a[3]:
                print("B")
            else:
                print("F")

        k = input()
    except EOFError:
        break

Python: figures = {
    "A": [[1, 1], [1, 1]],
    "B": [[1], [1], [1], [1]],
    "C": [[1, 1, 1, 1]], 
    "D": [[0, 1], [1, 1], [1, 0]],
    "E": [[1, 1, 0], [0, 1, 1]],
    "F": [[1, 0], [1, 1], [0, 1]],
    "G": [[0, 1, 1], [1, 1, 0]]
}

try:
    while True:
        a = [list(map(int, input())) for _ in [0]*8]

        for t, l in figures.items():
            x_size, y_size = len(l[0]), len(l)
            result = False
            for y in range(8-y_size+1):
                for x in range(8-x_size+1):
                    flag = True
                    for dy in range(y_size):
                        for dx in range(x_size):
                            if a[y+dy][x+dx] != l[dy][dx]:
                                flag = False
                    if flag:
                        result = True
                        break
                if result:
                    break
            if result:
                print(t)

        input()

except EOFError:
    exit()

Python: import sys


def analyze_figure(data):
    """
    ??????????????????????????§?????????????????£???????????????'1'????????£?????????????????¢??????
    ??????????????¨????????¶??????????????¢??????????????????
    """
    for i, row in enumerate(data):
        if '1' not in row:
            continue
        dot = row.count('1')
        if dot == 1:  # B, D, F???????????????
            x = row.index('1')
            try:
                if data[i+2][x] == '1':
                    return 'B'
                elif data[i+1][x+1] == '1':
                    return 'F'
                else:
                    return 'D'
            except IndexError:
                return None
        else:  # A, C, E, G???????????????
            x = row.index('1')
            try:
                if data[i][x+2] == '1':
                    return 'C'
                elif data[i+1][x] == '0':
                    return 'E'
                elif data[i+1][x+1] == '1':
                    return 'A'
                else:
                    return 'G'
            except IndexError:
                return None


if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        if '0' in line or '1' in line:
            data.append(line.strip())
            continue
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')

        # ???????????????
        ans = analyze_figure(data)

        # ???????????¨???
        if ans:
            print(ans)
        data = []

Python: import sys
#l=[t for t in sys.stdin]

while 1:
    e=[sys.stdin.readline() for _ in range(8)]
    l=[l.find("1") for l in e if l.find("1")!=-1]
    if not l:break
    if len(l)==1:print("C")
    elif len(l)==2:
        if l[0]==l[1]:print("A")
        elif l[0]<l[1]:print("E")
        elif l[0]>l[1]:print("G")
    elif len(l)==3:
        if l[0]>l[1]:print("D")
        elif l[0]<l[1]:print("F")
    else: print("B")
    if sys.stdin.readline() == "":break

Python: d = {
        ((0, 0), (1, 0), (0, 1), (1, 1))  : 'A',
        ((0, 0), (0, 1), (0, 2), (0, 3))  : 'B',
        ((0, 0), (1, 0), (2, 0), (3, 0))  : 'C',
        ((0, 0), (-1, 1), (0, 1), (-1, 2)): 'D',
        ((0, 0), (1, 0), (1, 1), (2, 1))  : 'E',
        ((0, 0), (0, 1), (1, 1), (1, 2))  : 'F',
        ((0, 0), (1, 0), (-1, 1), (0, 1)) : 'G'
    }


n = 9
while True:
    if n == 9:
        n = 0
        a = []
    try:
        line = input()
    except:
        break
    a.append(line)
    n += 1
    if n != 8: continue

    piece = [(x, y) for y in range(8) for x in range(8) if a[y][x] == '1']
    x0, y0 = piece[0]
    piece = tuple([(x - x0, y - y0) for x, y in piece])
    print(d[piece])