Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < n; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), ":")
		h, _ := strconv.Atoi(input[0])
		m, _ := strconv.Atoi(input[1])
		H, M := (30*h+(m/2))*2, (6*m)*2
		if m&1 == 1 {
			H++
		}
		a := H - M
		if a < 0 {
			a = -a
		}
		a2 := 720 - a
		if a2 < a {
			a = a2
		}
		if a < 60 {
			fmt.Println("alert")
		} else if a >= 180 && a <= 360 {
			fmt.Println("safe")
		} else {
			fmt.Println("warning")
		}
	}
}

Python: N = int(input())
for i in range(N):
    h, m = map(int, input().split(":"))
    d = abs(60*h - 11*m)
    v = min(d, 720 - d)
    if v < 60:
        print("alert")
    elif v < 180:
        print("warning")
    else:
        print("safe")

Python: n=int(input())
t=[[int(num)for num in input().split(':')]for i in range(n)]
for i in range(n):
    h=t[i][0]
    m=t[i][1]
    an_s=h*30+m/2
    an_l=m*6
    dif=0
    if abs(an_s-an_l)<180:dif=abs(an_s-an_l)
    else:dif=360-abs(an_s-an_l)
    if dif<30:
        print("alert")
    elif dif<90:
        print("warning")
    else:
        print("safe")

Python: def time():
    time_h, time_m = map(int, input().split(":"))
    short = time_m / 60 * 360
    long = time_h * 30 + (time_m / 60 * 30)
    judge = min(abs(short - long), 360 - abs(short - long))
    if 0 <= judge < 30:print("alert")
    elif 30 <= judge < 90:print("warning")
    else:print("safe")
n=int(input())
for i in range(n):time()

Python: import math

N = int(input())

for l in range(N):
    s = input()
    hh = int(s[0:2])
    mm = int(s[3:5])

    deg2 = 6 * mm
    deg1 = 30 * hh + deg2 / 60

    #print(deg1, deg2)
    d = abs(deg1-deg2)
    if d < 30 or 330 < d:
        print("alert")
    elif 90 <= d and d <= 270:
        print("safe")
    else:
        print("warning")

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135

"""
import sys
from sys import stdin
input = stdin.readline


def solve(time):
    # 12????????????0?????¨??????
    short_hand_angle = time[1] * 6
    long_hand_angle = (time[0]*60 + time[1]) / (12*60) * 360
    #print(short_hand_angle)
    #print(long_hand_angle)

    diff_angle = max(short_hand_angle, long_hand_angle) - min(short_hand_angle, long_hand_angle)
    while diff_angle > 180:
        diff_angle -= 180
    diff_angle = abs(diff_angle)

    if diff_angle < 30:
        return 'alert'
    elif 90 <= diff_angle <= 180:
        return 'safe'
    else:
        return 'warning'


def main(args):
    n = int(input())
    for _ in range(n):
        time = [int(x) for x in input().split(':')]
        result = solve(time)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: for _ in [0]*int(input()):
    h,m=map(int,input().split(":"))
    s=l=.0
    l=m*6
    s=30*(h+(m/60))
    if l<s:l,s=s,l
    if l-s>180:d=360-l+s
    else:d=l-s
    b='safe'
    if d<30:b='alert'
    elif d<90: b='warning'
    print(b)

Python: n=int(input())
t=[[int(num)for num in input().split(':')]for i in range(n)]
for i in range(n):
    h=t[i][0]
    m=t[i][1]
    an_s=h*30+m/60
    an_l=m*6
    if abs(an_s-an_l)<30:
        print("alert")
    elif abs(an_s-an_l)<90:
        print("warning")
    else:
        print("safe")

Python: def long_angle(h, m):
  return m * 6

def short_angle(h, m):
  return 30 * h + 0.5 * m

def diff_angle(la, sa):
  return abs(la - sa) % 180

def put_mess(dff):
  if dff < 30:
    print("alert")
  elif dff < 90:
    print("warning")
  else:
    print("safe")

n = int(input())
for _ in range(n):
  h, m = list(map(int, input().split(":")))
  dff = diff_angle(long_angle(h, m), short_angle(h, m))
  put_mess(dff)

Python: def solve(h,m):
    dm = m / 60.0 * 360.0
    dh = h / 12.0 * 360.0 + 360.0/ 12.0 * m / 60.0
    x = (abs(dh-dm)+180.0) % 180.0
    if 0 <= x < 30.0:
        return("alert")
    elif 90.0 <= x < 180.0:
        return("safe")
    else:
        return("warning")

n = int(input().strip())
for i in range(n):
    v = list(map(int, input().strip().split(':')))
    print(solve(v[0],v[1]))

Python: for _ in range(int(input())):
    hour, minute = [int(item) for item in input().split(":")]
    angle1 = hour * 5 * 6
    angle2 = minute * 6

    subtract = abs(angle1 - angle2)

    if subtract < 30:
        print("alert")
    elif 90 <= subtract:
        print("safe")
    else:
        print("warning")

Python: def long_angle(h, m):
  return m * 6

def short_angle(h, m):
  return 30 * h + 0.5 * m

def diff_angle(la, sa):
  max_a, min_a = max(la, sa), min(la, sa)
  dff = max_a - min_a
  if dff >= 180:
    return 360 - dff
  else:
    return dff


def put_mess(dff):
  if dff < 30:
    print("alert")
  elif dff < 90:
    print("warning")
  else:
    print("safe")

n = int(input())
for _ in range(n):
  h, m = list(map(int, input().split(":")))
  dff = diff_angle(long_angle(h, m), short_angle(h, m))
  put_mess(dff)

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135

"""
import sys
from sys import stdin
from math import sqrt, acos, cos, sin, radians, degrees
input = stdin.readline


def solve(time):
    # 12????????????90???
    short_hand_angle = time[1] * -6 + 90
    x_s = cos(radians(short_hand_angle))
    y_s = sin(radians(short_hand_angle))

    long_hand_angle = (time[0]*60+time[1])/(12*60) * -360 + 90
    x_l = cos(radians(long_hand_angle))
    y_l = sin(radians(long_hand_angle))
    c = (x_s * x_l + y_s * y_l) / (sqrt(x_s**2 + y_s**2) * sqrt(x_l**2 + y_l**2))
    ans = degrees(acos(c))

    if ans < 30:
        return 'alert'
    elif ans > 90:
        return 'safe'
    else:
        return 'warning'


def main(args):
    n = int(input())
    for _ in range(n):
        time = [int(x) for x in input().split(':')]
        result = solve(time)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: # -*- coding: utf-8 -*-
'import sys'
'import math'
n=int(input())
while n:
    h,m=map(int,input().split(":"))
    s=l=float(0.0)
    l=m*6.0
    s=30.0*(h+(m/60.0))
    if l<s:l,s=s,l
    if l-s>180.0:d=360-l+s
    else:d=l-s
    if d<30: print("alert")
    elif d<90: print("warning")
    else: print("safe")
    n-=1

Python: n=int(input())
t=[[int(num)for num in input().split(':')]for i in range(n)]
for i in range(n):
    h=t[i][0]
    m=t[i][1]
    an_s=h*30+m/60
    an_l=m*6
    dif=0
    if abs(an_s-an_l)<180:dif=abs(an_s-an_l)
    else:dif=360-abs(an_s-an_l)
    if dif<30:
        print("alert")
    elif dif<90:
        print("warning")
    else:
        print("safe")

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135
WA
"""
import sys
from sys import stdin
from math import sqrt, acos, cos, sin, radians, degrees
input = stdin.readline


def solve(time):
    # 12????????????90???
    short_hand_angle = time[1] * -6 + 90
    x_s = cos(radians(short_hand_angle))
    y_s = sin(radians(short_hand_angle))

    long_hand_angle = (time[0]*60+time[1])/(12*60) * -360 + 90
    x_l = cos(radians(long_hand_angle))
    y_l = sin(radians(long_hand_angle))
    c = (x_s * x_l + y_s * y_l) / (sqrt(x_s**2 + y_s**2) * sqrt(x_l**2 + y_l**2))
    ans = degrees(acos(c))

    if ans < 30:
        return 'alert'
    elif ans >= 90:
        return 'safe'
    else:
        return 'warning'


def main(args):
    n = int(input())
    # n = 1
    for _ in range(n):
        time = [int(x) for x in input().split(':')]
        result = solve(time)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])