#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

double ang(double a, double b){
    return min(abs(a-b), 360-abs(a-b));
}

int main(){
    int n;
    for(scanf("%d",&n);n--;){
        double a, b;
        scanf("%lf:%lf",&a,&b);
        a = a*30 + b/2;
        b = b*6;
        if( ang(a,b) < 30 ) puts("alert");
        else if( ang(a,b) < 90 ) puts("warning");
        else puts("safe");
    }
    return 0;
}