#include <bits/stdc++.h>
using namespace std;

int main(){
  int T;
  cin>>T;
  while(T--){
  int h,m;
  scanf("%d:%d",&h,&m);
  double A,B;
  A=360*(h/12.0);
  B=360*(m/60.0);
  if(abs(A-B)<=30)cout<<"alert"<<endl;
  else if(abs(A-B)<90)cout<<"warning"<<endl;
  else cout<<"safe"<<endl;
  
  }
  return 0;
}