#include <iostream>
#include <cstdio>
#define ABS(n) (((n)>0)?(n):(-(n)))
using namespace std;
int main()
{
  int n,h,m,l,s,d;
  cin >> n;
  while(n--){
    scanf("%d:%d",&h,&m);
    s = m * 12;
    l = 60 * h + m;
    d = ABS(l-s);
    if(d > 360) d = 720 - d;
    if(d < 60) cout << "alert" << endl;
    else if(180 <= d && d <= 360) cout << "safe" << endl;
    else cout << "warning" << endl;
  }
  return 0;
}