#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    int n;
    cin>>n;
    while(n--){
        int h,m;
        scanf("%d:%d",&h,&m);
        double h_angle,m_angle;
        h_angle = h/12.0 + m/720.0;
        m_angle = m/60.0;
        double d = fabs(h_angle - m_angle);
        if(d - (1.0/6) < 1e-8)cout<<"alert"<<endl;
        else if(d - (1.0/4) >= 0)cout<<"safe"<<endl;
        else cout<<"warning"<<endl;
    }


    return 0;
}