#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>

using namespace std;

inline int toInt(string s) { stringstream ss(s); int x; ss >> x; return x; }

int main() {
  int n;
  string s;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> s;
    int sh = toInt(s.substr(0, 2));
    int lg = toInt(s.substr(3));
    double argSh = sh*5*6;
    double argLg = lg*6; argSh += argLg/12;
    
    double hen = abs(argSh-argLg);
    hen = min(hen, 360.0-hen);
    if(0<=hen && hen<30) cout << "alert" << endl;
    else if(90<=hen && hen) cout << "safe" << endl;
    else cout << "warning"<< endl;
  }
  
  return 0;
}