#include<cstdio>
using namespace std;

int main(){
  int t,h,m;
  double l,s,ans;

  scanf("%d",&t);
  while(t--){
    scanf("%d:%d",&h,&m);
    s = m*6;
    l = h*30 + (double)m/2;

    ans = l-s;
    if(ans<0.0)ans *= -1.0;
    if(ans>180.0)ans = 360.0 - ans;

    if(ans<30.0)printf("alert\n");
    else if(ans<90.0)printf("warning\n");
    else printf("safe\n");
  }
}