#include<bits/stdc++.h>
using namespace std;
int main(){
  double n,a,b;
  cin>>n;
  while(n--){
    scanf("%lf:%lf",&a,&b);
    double c=abs(a*30+b/2-b*6);
    double d=min(c,360-c);
    if(d<30)cout<<"alert"<<endl;
    else if(d<90)cout<<"warning"<<endl;
    else cout<<"safe"<<endl;
  }
  return 0;
}