count = 0
flag = true
answer = ""
while gets
	line = $_.chomp
	count += 1
	if count == 8
		count = 0
		puts answer
		answer = ""
		flag = true
	end
	next if !(i = line.index("1")) || !flag
	c1,c2 = line[i],line[i+1]
	if c1==c2
		line2 = gets.chomp
		count += 1
		if !(j = line2.index("1"))
			answer, flag =  "C", false
			next
		elsif line2[j+1]!="1"
			answer, flag =  "B", false
			next
		else
			is_line3 = gets.chomp.index("1")
			count += 1
			if is_line3 && j < i
				answer, flag =  "D", false
				next
			elsif is_line3 && j==i
				answer, flag =  "F", false
				next
			elsif !is_line3 && i < j
				answer, flag =  "E", false
				next
			elsif !is_line3 && j < i
				answer, flag =  "G", false
				next
			else
				answer, flag =  "A", false
				next
			end
		end
	end
end