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

int main(){

  int n;
  int h,m;
  char c;
  double a,b;
  double ans;

  cin >> n;

  for(int l=0;l<n;l++){
    cin >> h >> c >> m;
    b = m * 6;
    a = 30 * h + 0.5 * m;

    ans = max(a,b) - min(a,b);
    if(ans > 180) ans -= 180;

    if(ans < 30) cout << "alert";
    else if(ans >= 90) cout << "safe";
    else cout << "warning";
    cout << endl;
  }
}