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

const double pi = acos(-1);

int main() {
  int n;
  scanf("%d", &n);
  while(n--) {
    int h, m;
    scanf("%d:%d", &h, &m);
    double rh = (h+m/60.0)/6.0;
    double rm = m/30.0;
    double rad = min(abs(rh-rm), abs(fmod(rh+1,2)-fmod(rm+1,2)));
    if(rad < 1.0/6.0) {
      cout << "alert" << endl;
    } else if(1.0/2.0 <= rad && rad <= 1.0) {
      cout << "safe" << endl;
    } else {
      cout << "warning" << endl;
    }
  }
  return 0;
}