#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  for (int k=0; k<n; k++) {
    int h, m;
    scanf("%d:%d", &h, &m);
    double t = (double)(h*60+m)/(12*60) * 360;
    double c = (double)m/60 * 360;
    if (t > c) swap(t, c);
    double sa = c - t;
    if (sa > 180) sa = 360 - sa;
    if (sa < 30) cout << "alert" << endl;
    else if (sa >= 90) cout << "safe" << endl;
    else cout << "warning" << endl;
  }
}