m = ["1100000011","1000000010000000100000001","1111","10000001100000001","11000000011","100000001100000001","110000011"]
d = ["A","B","C","D","E","F","G"]
s=""
loop do
  8.times{
    exit(0) if gets == nil    
    s += $_.chomp
  }
  7.times{|i|
    if s.index(m[i])
      puts d[i]
      break
    end
  }
end