#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n;
  cin >> n;
  cin.ignore();
  while(n--) {
    int h,m;
    scanf("%d:%d\n",&h,&m);
    double angh = h * 30 + m / 2.0;
    double angm = m * 6;
    if (angh<angm) swap(angm,angh);
    double ang = min(angh-angm, angm-angh+360);
    if (ang < 30)
      cout << "alert";
    else if (ang >= 90)
      cout << "safe";
    else
      cout << "warning";
    cout << endl;
  }
}