#include <stdio.h>

#define ABS(X) ((X)<0?-(X):(X))

int main(void){
    int n;
    int h,m;
    double angleH, angleM, dAngle;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%02d:%02d",&h, &m);
        //printf("%d, %d\n", h, m);
        angleM = 360*m/60.0;
        angleH = 360*h/12.0 + (360/12)*m/60.0;
        dAngle = (360 + angleM - angleH);
        while (dAngle > 180) dAngle -= 180;
        //printf("agl:%lf\n", dAngle);
        if (dAngle < 30){
            puts("alert");
        } else if (dAngle < 90){
            puts("warning");
        } else {
            puts("safe");
        }
    }
    
    return 0;
}