#include<iostream>
#include<queue>
#include<map>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define fr first
#define sc second
#define INF 100
typedef pair<int,int>Pt;
int main(){
  int n;
  double H,M,hh,mm,mini;
  scanf("%d",&n);
  while(n--){
    scanf("%lf:%lf",&hh,&mm);
    H = hh * 30.0 + mm * 0.25;
    M = mm * 6.0;
    mini = fabs(H - M);
    if(H<M) H += 360.0;
    else M += 360.0;
    mini = min(mini,fabs(H-M));

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