import Control.Monad

main :: IO ()
main = do
  n <- readLn
  ls <- replicateM n getLine
  let ls' = map (map (read :: String -> Int)) $ map divByC' ls
      ansL = map decide (map differ ls')
  mapM_ putStrLn ansL

divByC :: String -> [String] -> [String]
divByC "" ls = ls
divByC (s:':':ss) ls = [(head (head ls)):s:[],ss]
divByC (s:ss) ls = divByC ss [[s]]

divByC' :: String -> [String]
divByC' ss = divByC ss []

differ :: [Int] -> Double
differ [a,b] = min d (abs (360.0 - d))
  where x = 30.0 * (fromIntegral a) + 0.5 * (fromIntegral b)
        y = 6.0 * (fromIntegral b)
        d = abs (x - y)
decide :: Double -> String
decide d
  | d < 30.0 = "alert"
  | d >= 90.0 = "safe"
  | otherwise = "warning"