#include<stdio.h>
int min(int a,int b){return a>b?b:a;}
int abs(int a){return a<0?-a:a;}
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		int b,c;
		scanf("%d:%d",&b,&c);
		int hun=12*c;
		int ji=b*60+c;
		int ans=min(abs(hun-ji),720-abs(hun-ji));
		if(ans>=180)printf("safe\n");
		else if(ans>=60)printf("warning\n");
		else printf("alert\n");
	}
}