//29
#include<iostream>
#include<cmath>

using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    int h,m;
    (cin>>h).ignore()>>m;
    double hh=h/12.+m/60./12;
    double mm=m/60.;
    double d=fabs(hh-mm);
    if(d>.5){
      d=1-d;
    }
    if(d<30./360){
      cout<<"alert"<<endl;
    }else if(d<90./360){
      cout<<"warning"<<endl;
    }else{
      cout<<"safe"<<endl;
    }
  }
  return 0;
}