#include<iostream>
using namespace std;
int main(){
long n,h,m,i,y;
char c;
cin>>n;
for(i=0;i<n;i++){
cin>>h>>c>>m;
y=m*11-h*60;
if(y<0)y=-y;
if(y>360)y=720-y;
if(y<60)cout<<"alert"<<endl;
else if(y>=180)cout<<"safe"<<endl;
else cout<<"warning"<<endl;
}
return 0;
}