m = [/11[02]{7}11/,/1[02]{8}1[02]{8}1[02]{8}1/,/1111/,/1[02]{7}11[02]{7}1/,/11[02]{8}11/,/1[02]{8}11[02]{8}1/,/11[02]{6}11/]
d = ["A","B","C","D","E","F","G"]
loop do
  s=""
  8.times{
    s += gets.chomp+'2'
  }
  7.times{|i|
    if s.index(m[i])
      puts d[i]
      break
    end
  }
  exit(0) if gets == nil
end