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