#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const double EPS = 1e-10;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int h = stoi(s.substr(0, 2)), m = stoi(s.substr(3, 2));
    double argh = 360. * h / 12 + 30. * m / 60, argm = 360. * m / 60;
    double diff = min(abs(argh - argm), 360 - abs(argh - argm));
    if (diff < 30) cout << "alert" << endl;
    else if (diff >= 90) cout << "safe" << endl;
    else cout << "warning" << endl;
  }

  return 0;
}
