#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  int i,j,n,h,m;
  double rh,rm,ans;
  cin >> n;
  for(int z=0;z<n;z++){
    scanf("%d:%d",&h,&m);
    rh = rm = 0.0;
    for(i=0;i<h;i++) rh += 30.0;
    for(i=0;i<m;i++) rm += 6.0;
    rh += (double)m * 0.5;
    if(rh >= rm) ans = rh - rm;
    else ans = rm - rh;
    if(ans > 180.0) ans = 360.0 - ans;

    if(ans >= 90.0 && ans <= 180.0) cout << "safe" << endl;
    else if(ans >= 0.0 && ans < 30.0) cout << "alert" << endl;
    else cout << "warning" << endl;
  }
  return 0;
}