#include<stdio.h>

int main(){

int n;
double h,m;
double g=0,gm=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%lf:%lf",&h,&m);
g=30*h;gm=6*m;
g+=(0.5*m);
double H=0;
H=gm-g;
if(H<0)H*=-1;
if(H>180)H=360-H;

if(H<30)printf("alert\n");
else if(H<90)printf("warning\n");
else if(H<=180)printf("safe\n");
}
return 0;
}