n = gets.to_i
n.times do
  time = gets.chomp
  hour = time[0,2].to_i
  minute = time[3,2].to_i
  long_hand = 6*minute
  shor_hand = 30*hour + minute/2.0
  dif = (shor_hand-long_hand).abs
  dif = 360 - dif if 180 < dif
  if 0 <= dif && dif < 30
    puts "alert"
  elsif 90 <= dif && dif <= 180
    puts "safe"
  else
    puts "warning"
  end
end