#include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  double a,b;
  cin>>n;
  while(n--){
    scanf("%lf:%lf",&a,&b);
    a*=5;
    a+=b/60;
    int y=abs(b-a),x=abs(60-b+a);
    if(min(y,x)<=5)cout<<"alert"<<endl;
    else if(min(y,x)<=15)cout<<"warning"<<endl;
    else cout<<"safe"<<endl;
  }
}