#include<iostream>
using namespace std;
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        int t,m;
        (cin>>t).ignore()>>m;
        double t_ang=30*t,m_ang=6*m;
        t_ang+=30*(m/60.0);
        double dif=max(t_ang,m_ang)-min(t_ang,m_ang);
        dif=min(dif,360-dif);
        if(dif-30<0)cout<<"alert"<<endl;
        else if(dif-90>=0)cout<<"safe"<<endl;
        else cout<<"warning"<<endl;
    }
}