#include <iostream>
#include <cstdio>
using namespace std;
int abs(int a){
	return (a<0)?-a:a;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		int h,m,hp,mp;
		scanf("%02d:%02d",&h,&m);
		hp=h*60+m;
		mp=m*12;
		if(abs(mp-hp)%(60*12)*360<(60*12)*30) cout<<"alert\n";
		else if(abs(mp-hp)%(60*12)*360>=(60*12)*90&&abs(mp-hp)%(60*12)*360<=(60*12)*270) cout<<"safe\n";
		else cout<<"warning\n";
	}
	return 0;
}