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: maxl = 8

offsetV = ('A', 'B', 'C', 'D', 'E', 'F', 'G')
offset = (((0, 1), (1, 0), (1, 1)),
          ((0, 1), (0, 2), (0, 3)),
          ((1, 0), (2, 0), (3, 0)),
          ((0, 1), (-1, 1), (-1, 2)),
          ((1, 0), (1, 1), (2, 1)),
          ((0, 1), (1, 1), (1, 2)),
          ((1, 0), (-1, 1), (0, 1)),
          )


def match(l, x, y, oi):
    for offX, offY in [a for a in offset[oi]]:
        if 0 <= x + offX < maxl and 0 <= y + offY < maxl:
            pass
        else:
            return False

        if l[y + offY][x + offX] == '0':
            return False
    return True


def solve():
    l = [input() for i in range(8)]
    for y in range(8):
        for x in range(8):
            if l[y][x] == '1':
                for o in range(7):
                    if match(l, x, y, o):
                        return offsetV[o]



try:
    while 1:
        print(solve())
        l = input()
except:
    pass

Python: while True:
    try:
        figmap = [[0]*12 for _ in range(12)]
        for i in range(8):
            instr = input()
            for j in range(8):
                figmap[i][j+1] = int(instr[j])
        outi = outj = 0
        flag = True
        for i in range(12):
            for j in range(12):
                if figmap[i][j] == 1 and flag:
                    outi = i; outj = j
                    flag = False
        if figmap[outi+1][outj] * figmap[outi][outj+1] * figmap[outi+1][outj+1] == 1: print("A")
        if figmap[outi+1][outj] * figmap[outi+2][outj] * figmap[outi+3][outj] == 1: print("B")
        if figmap[outi][outj+1] * figmap[outi][outj+2] * figmap[outi][outj+3] == 1: print("C")
        if figmap[outi+1][outj] * figmap[outi+1][outj-1] * figmap[outi+2][outj-1] == 1: print("D")
        if figmap[outi][outj+1] * figmap[outi+1][outj+1] * figmap[outi+1][outj+2] == 1: print("E")
        if figmap[outi+1][outj] * figmap[outi+1][outj+1] * figmap[outi+2][outj+1] == 1: print("F")
        if figmap[outi+1][outj] * figmap[outi][outj+1] * figmap[outi+1][outj-1] == 1: print("G")

        input()
    except EOFError: 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 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(N=[input() for _ in range(8)]))
    except:break

Python: def get_data():
    array = []
    for i in range(8):
        array.append(input())
    return array

def judge():
    array = get_data()
    count = [[0 for i in range(8)] for i in range(8)]
    for i in range(8):
        x = 0
        for j in array[i]:
            if int(j) == 1:
                count[i][x] += 1
            x += 1

    a = 0
    p = []
    for i in range(8):
        for j in range(8):
            if count[i][j] != 0:
                p.append(a)
            a += 1

    if p[0]+1 != p[1]:
        if p[0] + 8*3 == p[3]:
            print('B')
        else:
            if p[0] + 8*2 + 1 == p[3]:
                print('F')
            else:
                print('D')
    else:
        if p[0]+1 == p[1] and p[1]+1 == p[2]:
            print('C')
        else:
            if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
                print('A')
            else:
                if p[0]+8 == p[3]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        judge()
    except:
        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
		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