#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()

struct hms {		// ツ篠楪甘板、ツ閉ェツ、ツ秒ツつェツ与ツつヲツづァツづェツつスツづつォツづ個計ツ算ツ陛「ツ渉閉。ツ秒ツづ可環キツ算ツ。ツ青ョツ青板氾。
  int t;
  int h, m, s;
  hms(int _h, int _m, int _s) {h=_h;m=_m;s=_s;t=h*3600+m*60+s;}
  hms(int _t) {t = _t; h = t/3600; m = t%3600/60; s=t%60;}
};

int main() {
  int n;
  cin >> n;
  cin.ignore();
  while(n--) {
    int h,m;
    scanf("%d:%d\n",&h,&m);
    double angh = 360.0*hms(h,m,0).t/hms(12,0,0).t;
    double angm = 360.0*m/60;
    if (abs(angh-angm) < 30)
      cout << "alert";
    else if (abs(angh-angm) >= 90)
      cout << "safe";
    else
      cout << "warning";
    cout << endl;
  }
}