#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int n;
  cin>>n;
  REP(i,n){
    int h,m;
    scanf("%d:%d",&h,&m);
    if(h>=12) h -= 12;
    double t1 = h * 30 + (double)m/2;  
    double t2 = m * 6; 
    if(abs(t1-t2)<30||abs(t1-t2)>330){
      cout<<"alert"<<endl;
    }else if(abs(t1-t2)>=90&&abs(t1-t2)<=270){
      cout<<"safe"<<endl;
    }else{
      cout<<"warning"<<endl;
    }
  }
  return 0;
}