#include <iostream>
#include <cstdio>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  int n;
  vector<string> result;
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    int h, m;
    double rh, rm;
    scanf("%d:%d\n", &h, &m);
    // (m / 60 * 360) == (h * 6)                                                                                                                  
    rm = m * 6.0;
    rm += (rm > 180 ? -360 : 0);
    // (h / 12 * 360) == (h * 6)                                                                                                                  
    rh = h * 30.0;
    rh += m * 0.5;
    rh += (rh > 180 ? -360 : 0);
    double dis = rh - rm;
    dis *= (dis >= 0 ? 1 : -1);
    if (dis < 30.0)
      result.push_back("alert");
    else if (90 <= dis)
      result.push_back("safe");
    else
      result.push_back("warning");
  }

  for (int i = 0; i < n; i++)
    cout << result[i] << endl;
  return 0;
}