#include<iostream>
#include<cmath>

using namespace std;

double topos(int in,int num){
  if(num)return in * 6;
  return in * 30;
}

void solve(double h, double m){
  double judge = fabs(h-m);
  if(judge > 180) judge = 360 - judge;
  //cout << judge << endl;
  if(judge <= 30) cout << "alert" << endl;
  else if(judge < 90) cout << "warning" << endl;
  else cout << "safe" << endl;
}

int main(){
  int in;
  cin >> in;
  for(int i = 0; i < in; i++){
    int hour,minite;
    char trash;
    cin >> hour >> trash >> minite;
    //cout << hour << " " << trash << " " << minite<<endl;
    double pos = topos(minite,1);
    double posh = topos(hour,0);
    solve(posh,pos);
  }
  return 0;
}