#include<iostream>
#include<cmath>
using namespace std;
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
int main(){
	double hh,mm;
	char c;
	int n;
	cin>>n;
	rep(i,n){
		cin>>hh>>c>>mm;
		hh=30*hh+0.5*mm;mm*=6;
//		cout<<hh<<"-"<<mm<<"="<<abs(hh-mm)<<" "<<abs(hh-mm);
		if(abs(hh-mm)<=30)cout<<"alert";
		else if(90<=abs(hh-mm)&&abs(hh-mm)<=180)cout<<"safe";
		else cout<<"warning";
		cout<<endl;
	}
}