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 < 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:
        s = [input() for _ in range(8)]
        a_b = True
        for i in range(8):
            for j in range(8):
                ss = s[i][j]
                if int(ss) == 1 and a_b:
                    a_b, a_v = False, (i, j)
                if int(ss) == 1 and not a_b:
                    z_v = (i, j)
        if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
            print("A")
        elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
            print("B")
        elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
            print("C")
        elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
            print("D")
        elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
            print("E")
        elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
            print("F")
        else:
            print("G")
    except:
        break

Python: Figures = {"A": [[0, 1], [1, 0], [1, 1]],
           "B": [[1, 0], [2, 0], [3, 0]],
           "C": [[0, 1], [0, 2], [0, 3]],
           "D": [[1, -1], [1, 0], [2, -1]],
           "E": [[0, 1], [1, 1], [1, 2]],
           "F": [[1, 0], [1, 1], [2, 1]],
           "G": [[0, 1], [1, -1], [1, 0]]}
while True:
    try:
        k = [map(int, list(input())) for i in range(8)]
        l = [[y, x] for y,q in enumerate(k) for x,t in enumerate(q) if t]
        a, b = l[0]
        for i in range(4):
            l[i][0] -= a
            l[i][1] -= b
        for k, v in Figures.items():
            if l[1:] == v:
                print(k)
                break
        input()
    except:
        break

Python: def trim(N):
    num=[]
    for x in range(8):
        for y in range(8):
            if N[y][x]=="1":
                if not num:
                    refer=(x,y)
                num.append((x,y))
    num=[(x-refer[0],y-refer[1]) for x,y in num]
    return num
def points(point):
    if point==[(0,0),(0,1),(1,0),(1,1)]:print("A")
    if point==[(0,0),(0,1),(0,2),(0,3)]:print("B")
    if point==[(0,0),(1,0),(2,0),(3,0)]:print("C")
    if point==[(0,0),(0,1),(1,-1),(1,0)]:print("D")
    if point==[(0,0),(1,0),(1,1),(2,1)]:print("E")
    if point==[(0,0),(0,1),(1,1),(1,2)]:print("F")
    if point==[(0,0),(1,-1),(1,0),(2,-1)]:print("G")
while True:
    N=[input() for _ in range(8)]
    points(trim(N))
    try:
        input()
    except:break

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:
        t = line.strip()
        if t:
            t = '00' + t + '00'
            data.append(t)
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')


        # ???????????????
        if len(data) == 8:
            data.append('000000000000')
            data.append('000000000000')
            ans = analyze_figure(data)

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

Python: while 1:
 a=[list(map(int,input()))for _ in[0]*8]
 y=[sum(r)for r in a]
 x=[sum(c)for c in zip(*a)]
 if 4 in x:s='B'
 elif 4 in y:s='C'
 elif 1 in y:s='DF'[a[y.index(1)][x.index(2)]]
 elif 1 in x:s='GE'[a[y.index(2)][x.index(1)]]
 else:s='A'
 print(s)
 try:input()
 except:break

Python: s = []
while True:
    try:
        s = [input()+"\n" for _ in range(8)]
    except:
        break
    a_b = True
    for i in range(8):
        for j in range(8):
            ss = s.splitlines()[i][j]
            if int(ss) == 1 and a_b:
                a_b, a_v = False, (i, j)
            if int(ss) == 1 and not a_b:
                z_v = (i, j)
    if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
        print("A")
    elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
        print("B")
    elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
        print("C")
    elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
        print("D")
    elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
        print("E")
    elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
        print("F")
    else:
        print("G")

Python: import sys
l=[t for t in sys.stdin]
i=0
while 1:
    pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
    if not pt:break
    if len(pt)==1:print("C")
    elif len(pt)==2:
        if pt[0]==pt[1]:print("A")
        elif pt[0]<pt[1]:print("E")
        elif pr[0]>pt[1]:print("G")
    elif len(pt)==3:
        if pt[0]>pt[1]:print("D")
        elif pt[0]<pt[1]:print("F")
    else: print("B")
    i+=1