n = gets.to_i
t = []*n
0.upto(n-1) {|i| t[i] = gets.chomp.split(":").map(&:to_i)}

0.upto(n-1) do |i|
  a,b = t[i]
  long = b * 6
  short = (a + b.to_f / 60) * 30
  r = (long - short).abs
  r = 180 - r if r > 180
  case r
  when 0...30
    puts "alert"
  when 30...90
    puts "warning"
  when 90...180
    puts "safe"
  end
end