#include<iostream>

using namespace std;

double topos(int in){
  return in * 0.2;
}

void solve(double h, double m){
  if(h < m) swap(h,m);
  if(h - m < 1.0) cout << "alert" << endl;
  else if(h - m < 3.0) 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);
    solve((double)hour,pos);
  }
  return 0;
}