#include <bits/stdc++.h>

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

int main()
{
  // 1分で進む角度で考える
  // 長針 1分 => 6度
  // 短針 60分 => 30度 :: 1分 => 0.5度
  rep(i, in()){
    double h, m;
    scanf("%lf:%lf", &h, &m);
    h = (int)h * 30 + m / 2.0;
    m *= 6;
    double deg = min(abs(h - (360 - m)), abs(h - m));
    if (0 <= deg && deg < 30){
      puts("alert");
    }
    else if (90 <= deg && deg <= 180){
      puts("safe");
    }
    else {
      puts("warning");
    }
  }
  return 0;
}