#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
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((int)abs((double)(mp-hp))%(60*12)<(60*12)*30/360) cout<<"alert\n";
		else if((int)abs((double)(mp-hp))%(60*12)>=(60*12)*90/360&&(int)abs((double)(mp-hp))%(60*12)<=(60*12)*180/360) cout<<"safe\n";
		else cout<<"warning\n";
	}
	return 0;
}