#include<iostream>
#include<algorithm>
using namespace std;
int n,h,m;
int a,b,c,d,A,B;
char ch;
int main(){
  cin>>n;
  while(n--){
    cin>>h>>ch>>m;
    a=h*30+(m/12)*6;
    b=m*6;
    
    c=0;
    A=a;
    B=b;

    while(A!=B){
      A+=6;
      c+=6;
      if(A>=360)A-=360;
    }
      
    d=0;
    A=a;
    B=b;
    while(A!=B){
      B+=6;
      d+=6;
      if(B>=360)B-=360;
      
    }

    //cout << a<< ' '<<b<<' '<<c<<endl;
    
    c=min(c,d);

    if(0<=c&&c<=30){
      cout<<"alert"<<endl;
    }else if(90<c&&c<=180){
      cout<<"safe"<<endl;
    }else{
      cout<<"warning"<<endl;
    }
    
  }
  return 0;
}