readlines.each do |times|
  time_500, time_1000 = times.split.map(&:to_f)
  if time_500 < 35.50 && time_1000 < 71.00
    puts "AAA"
  elsif time_500 < 37.50 && time_1000 < 77.00
    puts "AA"
  elsif time_500 < 40.00 && time_1000 < 83.00
    puts "A"
  elsif time_500 < 43.00 && time_1000 < 89.00
    puts "B"
  elsif time_500 < 50.00 && time_1000 < 105.00
    puts "C"
  elsif time_500 < 55.00 && time_1000 < 116.00
    puts "D"
  elsif time_500 < 70.00 && time_1000 < 148.00
    puts "E"
  else
    puts "NA"
  end    
end