#include<iostream>
#include<algorithm>
using namespace std;
int n,h,m;
double a,b,c,d;
char ch;
int main(){
  cin>>n;
  while(n--){
    cin>>h>>ch>>m;
    a=h*30+m/2.0;
    b=m*6;
      
     
    c=max(a,b)-min(a,b);
    if(c>180){
      c=360-c;
    }
  
    //cout << a<< ' '<<b<<' '<<c<<endl;
      
    if(0<=c&&c<30){
      cout<<"alert"<<endl;
    }else if(90<=c&&c<=180){
      cout<<"safe"<<endl;
    }else{
      cout<<"warning"<<endl;
    }
      
  }
  return 0;
}