for roop in range(int(input())):

    h,m = list(map(int,input().split(":")))

    s = 120*h + 2*m

    l = 24*m

    if l < s: l,s = s,l

    arg = l - s if l - s < 180*4 else 360*4-(l-s)

    if   arg < 30*4: print("alert")

    elif arg < 90*4: print("warning")

    else           : print("safe")
for roop in range(int(input())):

    h,m = list(map(int,input().split(":")))

    s = 60*h + m

    l = 12*m

    if l < s: l,s = s,l

    arg = l - s if l - s < 180*2 else 360*2-(l-s)

    if   arg < 30*2: print("alert")

    elif arg < 90*2: print("warning")

    else           : print("safe")
for roop in range(int(input())):
    h, m = list(map(int, input().split(":")))
    s = 120 * h + 2 * m
    l = 24 * m
    if l < s:
        l, s = s, l
    arg = l - s if l - s < 180 * 4 else 360 * 4 - (l - s)
    if arg < 30 * 4:
        print("alert")
    elif arg < 90 * 4:
        print("warning")
    else:
        print("safe")

for roop in range(int(input())):
    h, m = list(map(int, input().split(":")))
    s = 60 * h + m
    l = 12 * m
    if l < s:
        l, s = s, l
    arg = l - s if l - s < 180 * 2 else 360 * 2 - (l - s)
    if arg < 30 * 2:
        print("alert")
    elif arg < 90 * 2:
        print("warning")
    else:
        print("safe")

-    s = 120 * h + 2 * m -    l = 24 * m +    s = 60 * h + m +    l = 12 * m -    arg = l - s if l - s < 180 * 4 else 360 * 4 - (l - s) -    if arg < 30 * 4: +    arg = l - s if l - s < 180 * 2 else 360 * 2 - (l - s) +    if arg < 30 * 2: -    elif arg < 90 * 4: +    elif arg < 90 * 2: