#include <iostream>
#include <cstdio>
#include <cmath>
#define PI 3.14159265
using namespace std;

int h,m;

void solve() {
  double longhand,shorthand,theta;
  longhand = (30*h + (30.0/60.0)*m);
  shorthand = 6*m;
  //  cout << longhand << " " << shorthand << endl;
  theta = min(abs( longhand - shorthand),360-abs( longhand - shorthand));
  //  cout << theta << endl;
  if(theta < 30.0) {
    cout << "alert" << endl;
  }
  else if(theta <= 180 && 90 <= theta) {
    cout << "safe" << endl;
  }
  else {
    cout << "warning" << endl;
  }
}

int main() {
  int n;
  cin >> n;
  for(int i=0;i<n;i++) {
    scanf("%d:%d\n",&h,&m);
    solve();
  }
}