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
}

var emptyBoard = [][]int{{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,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			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)
		fmt.Scanln()
	}
}

Python: import sys

for s in sys.stdin:
	sur = [list(map(int, s.strip()))]
	if 1 not in sur[0]:
		sur.pop()
	for _ in range(7):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

Python: while True:
    try:
        Map = []
        Base = []
        End = []
        for i in range(8):
            Map.append(list(map(str,input())))
        for i in range(8):
            if Base == []:
                
                for j in range(8):
                    if Map[i][j] == '1':
                        Base = [j,i]
                        break
            else:
                break
        for i in range(7,-1,-1):
            if End == []:
                for j in range(7,-1,-1):
                    if Map[i][j] == '1':
                        End = [j,i]
                        break
            else:
                break
        Yoko = End[0] - Base[0]
        Tate = End[1] - Base[1]
        if Tate == 1 and Yoko == 1:
            print("A")
        elif Yoko == 0 and Tate == 3:
            print("B")
        elif Tate == 0 and Yoko == 3:
            print("C")
        elif Yoko == -1 and Tate == 2:
            print("D")
        elif Yoko == 2 and Tate == 1:
            print("E")
        elif Yoko == 1 and Tate == 2:
            print("F")
        elif Tate == 1 and Yoko == 0:
            print("G")
        kara = input()
            
    except EOFError:
        break

Python: import sys

for s in sys.stdin:
	sur = [list(map(int, s.strip()))]
	if 1 not in sur[0]:
		sur.pop()
	for _ in range(7):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

Python: # -*- coding: utf-8 -*-

import sys
import os

d = {}
d['A'] = ['11', '11']
d['B'] = ['1', '1', '1', '1']
d['C'] = ['1111']
d['D'] = ['01', '11', '10']
d['E'] = ['110', '011']
d['F'] = ['10', '11', '01']
d['G'] = ['011', '110']

DEBUG = False

A = []
for s in sys.stdin:
    s = s.strip()
    if s == '':
        continue

    A.append(s)

    if len(A) == 8:
        # solve
        # ...
        answer = None

        for key in d.keys():
            figure = d[key]
            W = len(figure[0])
            H = len(figure)

            for x in range(8 - W + 1):
                for y in range(8 - H + 1):
                    # check
                    is_fit = True
                    for i, row in enumerate(figure):
                        if not row == A[y+i][x:x+W]:
                            is_fit = False
                            break
                    if is_fit:
                        if DEBUG:
                            print()
                            print('all fit', key)
                            print('A', A)
                            print('x, y', x, y)
                            print('W, H', W, H)
                            print('figure', figure)
                        answer = key
        print(answer)
        A = []

Python: def match(a,b):
    for i in range(len(b)):
        if a == b[i:i+len(a)]:
            return(True)
    return(False)

pat = {'A':[1,1]+[0]*6+[1,1],
       'B':([1]+[0]*7)*3+[1],
       'C':[1]*4,
       'D':[1]+[0]*6+[1,1]+[0]*6+[1],
       'E':[1,1]+[0]*7+[1,1],
       'F':[1]+[0]*7+[1,1]+[0]*7+[1],
       'G':[1,1]+[0]*5+[1,1]}

while True:
    try:
        pla = []
        for _ in range(8):
            l = input().strip()
            pla += map(int,list(l))

        for i in ['A','B','C','D','E','F','G']:
            if match(pat[i],pla):
                print(i)
        input()
    except EOFError:
        break

Python: # coding: utf-8
# Your code here!

input_lines = int(input())
for i in range(input_lines):
  s = input().rstrip().split("\n")
 
#for i range 8:
    

print (s)

Python: inputs = int(input())
for i in range(inputs):
  s = i
 
#for i range 8:
    

print (s)

Python: from functools import lru_cache

@lru_cache(maxsize=None) 
def check(data):   
        if A in data:
                print("A")
        elif B in data:
                print("B")
        elif C in data:
                print("C")
        elif D in data:
                print("D")
        elif E in data:
                print("E")
        elif F in data:
                print("F")
        elif G in data:
                print("G")
                

A = '1'*2 + '0'*6 +'1'*2
B = '1' + '0'*7 + '1' + '0'*7 + '1' + '0'*7 + '1'
C = '1'*4
D = '1' + '0'*6 +'1'*2 + '0'*6 +'1'
E = '1'*2 + '0'*7 + '1'*2
F = '1' + '0'*7 + '1'*2 + '0'*7 +'1'
G = '1'*2 + '0'*5 +'1'*2

while True: 
        data = ''.join(map(lambda x: input(), range(8)))
        check(data)
        try: input()
        except: break

Python: ans = {"1100000011": "A", "1000000010000000100000001": "B",
       "1111": "C", "1000000110000001": "D",
       "11000000011": "E", "100000001100000001": "F", "0110000011": "G"}
while True:
    try:
        st = ""

        for i in range(8):
            st += input()

        for k, v in ans.items():
            if st.find(k) != -1:
                print(v)
                break
    except:
        break