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