#include<iostream>
#include<cmath>
using namespace std;

int main(void){
	int n;
	
	cin>> n ;
	for(int i = 0 ; i < n ; i++){
		int a,b; char c;
		
		cin>>a>>c>>b;
//		cout<<a<<" "<<b<<endl;
		double A =a/12.0+b/60.0/12;
		double B =b/60.0;
		
		double judge =fabs(A-B);
//		if(180<judge)judge = 360.0 - judge;
//		cout<<judge<<endl;
	
		if(judge>0.5){
			judge = 1 - judge;
		}
		if(judge<30.0/360)cout<<"alert"<<endl;
		else if(judge<90.0/360)cout<<"warning"<<endl;
		else cout<<"safe"<<endl;
	}
	return 0;
}