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

int main(){
  int n;
  cin >> n;
  while(n--){
    int h, m;
    scanf("%d:%d", &h, &m);
    double H = (double)h * 30 + m*0.5;
    double M = (double)m * 6;
    
    double ans = abs(H-M);
    if(180 < ans) ans = 360.0 - ans;
    
    if(0 <= ans && ans < 30) cout << "alert" << endl;
    else if(90 <= ans && ans <= 180) cout << "safe" << endl;
    else cout << "warning" << endl;
  }
  return 0;
}