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
}

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: s = []
while True:
    try:
        s = [input() for _ in range(8)]
    except:
        break
    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")

Python: #"1"の座標を、最初のものを(0,0)として切り出し
def trim(mp):
  ret = []

  for x in range(8):
    for y in range(8):
      if mp[y][x] == "1":
        if not ret:
          refer = (x, y)
        ret.append((x, y))

  ret = [(x - refer[0], y - refer[1]) for x, y in ret]
  return ret

#座標が一致したものを出力
def put_ans(points):
  if points == [(0, 0), (0, 1), (1, 0), (1, 1)]: print("A")
  if points == [(0, 0), (0, 1), (0, 2), (0, 3)]: print("B")
  if points == [(0, 0), (1, 0), (2, 0), (3, 0)]: print("C")
  if points == [(0, 0), (0, 1), (1, 0), (1, -1)]: print("D")
  if points == [(0, 0), (1, 0), (1, 1), (2, 1)]: print("E")
  if points == [(0, 0), (0, 1), (1, 1), (1, 2)]: print("F")
  if points == [(0, 0), (1, -1), (1, 0), (2, -1)]: print("G")

while True:
  mp = [input() for _ in range(8)]
  put_ans(trim(mp))
  try:
    input()
  except EOFError:
    break

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 and pt[0]==pt[1]:print("A")
    elif len(pt)==2 and pt[0]<pt[1]:print("E")
    elif len(pt)==2 and pr[0]>pt[1]:print("G")
    elif len(pt)==3 and pt[0]>pt[1]:print("D")
    elif len(pt)==3 and pt[0]<pt[1]:print("F")
    else: print("B")
    i+=1

Python: def trim():
    num=[]
    N=[input() for _ in range(8)]
    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 point(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:
    try:
        point(trim())
    except:break

Python: while True:
    string = [input() for _ in range(8)]
    string = [int(l) for line in string for l in line] + [0]*16
    one = string.index(1)
    s = string[one:]
    ones = [[1, 8, 9], [8, 16, 24], [1, 2, 3],
            [7, 8, 15], [1, 9, 10], [8, 9, 17], [1, 7, 8]]
    ans = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E", 5: "F", 6: "G"}
    for k, o in enumerate(ones):
        if all([s[o[0]], s[o[1]], s[o[2]]]):
            print(ans[k])
    try:
        input()
    except:
        break

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:print('B')
 elif 4 in y:print('C')
 elif 1 in y:print('DF'[a[y.index(1)][x.index(2)]])
 elif 1 in x:print('GE'[a[y.index(2)][x.index(1)]])
 else:print('A')
 try:input()
 except:break

Python: # -*- coding: utf-8 -*-
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']],
}


def f1(lines):
    for n, figure in figures.items():
        found = f2(lines, figure)
        if found:
            print(n)
            break


def f2(lines, figure):
    height = len(figure)
    width = len(figure[0])
    for h in range(8 - height + 1):
        for w in range(8 - width + 1):
            found = f3(lines, figure, height, width, h, w)
            if found:
                return True


def f3(lines, figure, height, width, h, w):
    _figure = [[lines[h+_h][w+_w] for _w in range(width)]
               for _h in range(height)]
    if figure == _figure:
        return True


try:
    while True:
        f1([list(input()) for _ in range(8)])
        input()
except EOFError:
    pass

Python: A=[[0,0],[1,0],[0,1],[1,1]]
B=[[0,0],[0,1],[0,2],[0,3]]
C=[[0,0],[1,0],[2,0],[3,0]]
D=[[0,0],[-1,1],[0,1],[-1,2]]
E=[[0,0],[1,0],[1,1],[2,1]]
F=[[0,0],[0,1],[1,1],[1,2]]
G=[[0,0],[1,0],[-1,1],[0,1]]
humen=[]
gentenx="0"
genteny="0"
kigou=[]
ans=[]
s=""
while(1):
    
    
    if len(humen)>=8:
        for y in range(0,8):#y
            for x in range(0,8):#x
                if humen[y][x]=="1" and gentenx=="0" and genteny=="0":#位置記憶
                    gentenx=x
                    genteny=y
                    kigou.append([0,0])
                elif humen[y][x]=="1" :
                    kigou.append([x-gentenx,y-genteny])
        if A==kigou:ans.append("A")
        if B==kigou:ans.append("B")
        if C==kigou:ans.append("C")
        if D==kigou:ans.append("D")
        if E==kigou:ans.append("E")
        if F==kigou:ans.append("F")
        if G==kigou:ans.append("G")
        kigou=[]
        humen=[]
        gentenx="0"
        genteny="0"
    try: s=str(input(""))
    except:break
    if s!="":humen.append(list(s))

for i in ans:
    print(i)

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