#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>

#define	min3(a,b,c)	min((a),min((b),(c)))

using namespace std;

int main()
{
	int n;	cin>>n;
	while(n--){
		int h,m;	scanf("%d:%d",&h,&m);
		double degh=30*h+0.5*m,degm=6*m;
		double deg=min3(abs(degh-degm),abs(degh-degm-360),abs(degh-degm+360));
		if     (deg<30)	cout<<"alert"<<endl;
		else if(deg<90)	cout<<"warning"<<endl;
		else			cout<<"safe"<<endl;
	}
	return 0;
}