for _ in [0]*int(eval(input())):

    h,m=list(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

    if d<30: print('alert')

    elif d<90: print('warning')

    else: print('safe')
for _ in [0]*int(eval(input())):

    h,m=list(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)
for _ in [0] * int(eval(input())):
    h, m = list(map(int, input().split(":")))
    s = l = 0.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
    if d < 30:
        print("alert")
    elif d < 90:
        print("warning")
    else:
        print("safe")

for _ in [0] * int(eval(input())):
    h, m = list(map(int, input().split(":")))
    s = l = 0.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)

+    b = "safe" -        print("alert") +        b = "alert" -        print("warning") -    else: -        print("safe") +        b = "warning" +    print(b)