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

int main(){
  int n,h,s;
  double a,b,ans;
  cin>>n;
  while(n--){
    scanf("%d:%d",&h,&s);
    b=s*6;
    a=h*30+b/360;
    ans=abs(a-b);
    if(ans>180)ans=360-ans;
    if(0<=ans&&ans<30)cout<<"alert"<<endl;
    else if(90<=ans&&ans<=180)cout<<"safe"<<endl;
    else cout<<"warning"<<endl;
  }
  return 0;
}