#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    for (int i=0;i<n;i++) {
        double h,m;
        char c;
        cin>>h>>c>>m;
        double angle_h=30.0*h+30.0*m/60.0;
        double angle_m=m*6;
        double angle=min(abs(angle_h-angle_m),abs(angle_m-angle_h));
        if (angle>=180) {
            angle=360-angle;
        }
        //cout<<angle_h<<" "<<angle_m<<" "<<angle<<endl;
        if (angle<30) {
            cout<<"alert"<<endl;
        } else if (angle>=90&&angle<=180) {
            cout<<"safe"<<endl;
        } else {
            cout<<"warning"<<endl;
        }
    }
}
