#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        double h,m;
        scanf("%lf:%lf",&h,&m);
        double totalm=h*60+m;
        double hh=totalm/2,mm=m*6;
        while(359.999999<hh)hh-=360;
        double ans=min(fabs(hh-mm),fabs(hh-360-mm));
        if(ans<30)puts("alert");
        else if(ans<90)puts("warning");
        else puts("safe");
    }
    return 0;
}