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: # -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

s=[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,1,1,0,0,0,0,0],[0,0,1,1,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]]
s2=[[0,0,0,1,1,1,1,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]]
s3=[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,1,1,0,0,0,0],[0,0,1,1,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]]

#はじめに1に当たる座標のみを取得し、その座標の右隣り＝r、下隣=b、みぎした隣=nより探索する
def Sakana(s):
    for i in range(0,len(s)-1):
        #print ("a")
        for o in range(0,len(s[i])-1):
            #print (s[i][o])
            if s[i][o]==1:
                #下
                b=s[i+1][o]
                #右
                r=s[i][o+1]
                #右斜めした
                n=s[i+1][o+1]
                    
                #判定
                if b==1 and r==1 and n==1:
                    return "A"
                if b==1 and r==1 and n==0:
                    return "G"
                if b==0 and r==1 and n==0:
                    return "C"
                if b==1 and r==0 and n==0:
                    if s[i+2][o] == 0:
                        return "D"
                    else:
                        return "B"
                if b==1 and r==0 and n==1:
                    return "F"
                if b==0 and r==1 and n==1:
                    return "E"
                break

print(Sakana(s))
print(Sakana(s2))
print(Sakana(s3))

Python: def solve():
    line = input()
    while True:
        surface = list(map(int, line))
        for _ in range(7):
            surface.extend(map(int, input()))
        
        for i, v in enumerate(surface):
            if not v == 1:
                continue
            
            # A
            if i+9 < 64 and surface[i+1] == 1 and surface[i+8] == 1 and surface[i+9] == 1:
                print('A')
                break
            
            # B
            if i+24 < 64 and surface[i+24] == 1:
                print('B')
                break
            
            # C
            if surface[i+3] == 1:
                print('C')
                break
            
            # D
            if i+15 < 64 and surface[i+15] == 1:
                print('D')
                break
            
            # E
            if i+10 < 64 and surface[i+10] == 1:
                print('E')
                break
            
            # F
            if i+17 < 64 and surface[i+17] == 1:
                print('F')
                break
            
            # G
            if surface[i+1] == 1 and surface[i+7] == 1 and surface[i+8] == 1:
                print('G')
                break
            
        
        try:
            input()
            line = input()
        except EOFError:
            break
    

if __name__ == "__main__":
    solve()

Python: while 1:
	try:
		pos=[]
		for i in xrange(8):
			s=raw_input()
			for j in xrange(8):
				if int(s[j])==1:
					pos.append([i,j])
		if pos[0][0]+1==pos[3][0] and pos[0][1]+1==pos[3][1]:
			print('A')
		elif pos[0][0]+3==pos[3][0]:
			print('B')
		elif pos[0][1]+3==pos[3][1]:
			print('C')
		elif pos[0][1]==pos[3][1]-1:
			print('D')
		elif pos[0][0]+1==pos[3][0] and pos[0][1]+2==pos[3][1]:
			print('E')
		else:
			print('F')
		raw_input()
	except:
		break

Python: while 1:
	try:
		pos=[]
		for i in xrange(8):
			s=raw_input()
			for j in xrange(8):
				if int(s[j])==1:
					pos.append([i,j])
		if pos[0][0]+1==pos[3][0] and pos[0][1]+1==pos[3][1]:
			print('A')
		elif pos[0][0]+3==pos[3][0]:
			print('B')
		elif pos[0][1]+3==pos[3][1]:
			print('C')
		elif pos[0][1]==pos[3][1]+1:
			print('D')
		elif pos[0][0]+1==pos[3][0] and pos[0][1]+2==pos[3][1]:
			print('E')
		elif pos[0][0]+2==pos[3][0]:
			print('F')
		else:
			print('G')
		raw_input()
	except:
		break

Python: # -*- coding:utf-8 -*-
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*2 == p[2]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        judge()
    except EOFError:
        break

Python: while True:
    try:
        l = []
        for i in range(8):
            l += list(map(int, input()))
    except:
        break

    cnt = 0
    for i in range(len(l)):
        if l[i]:
            cnt += i
    cnt -= l.index(1) * 4

    if cnt == 18:
        ans = "A"
    elif cnt == 48:
        ans = "B"
    elif cnt == 6:
        ans = "C"
    elif cnt == 34:
        ans = "D"
    elif cnt == 20:
        ans = "E"
    elif cnt == 34:
        ans = "F"
    else:
        ans = "G"

    print(ans)