#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

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

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int n;
  scanf("%d",&n);
  while(n --> 0){
    int h,m;
    scanf("%d:%d",&h,&m);
    double hh,mm;
    mm = m * (360.0/60.0);
    hh = (h + (m/60.0)) * (360.0/12.0);
    if(abs(hh-mm) >= 90 && abs(hh-mm) <= 180) puts("safe");
    else if(abs(hh-mm) < 30) puts("alert");
    else puts("warning");
  }
  return 0;
}