#include <stdio.h>
#include <math.h>
int main(){
    int n,i;
    scanf("%d",&n);
    for (i=0; i<n; i++) {
        int h,m,x;
        scanf("%d:%d",&h,&m);
        x=fmod(5.5*(60*h+m),360);
        if ((x>=0&&x<30)||x>330) {
            printf("alert\n");
        }else if (x>=90&&x<=270){
            printf("safe\n");
        }else{
            printf("warning\n");
        }
    }
    return 0;
}