#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 =(double)a*30+b*0.5;
		double B =(double)b*6;
		
		double judge = abs(A-B);
		if(180<judge)judge = 360.0 - judge;
//		cout<<judge<<endl;
	
//		cout<<a<<" "<<b<<" "<<judge<<endl;
		if(0<=judge && judge<30)cout<<"alert"<<endl;
		else if(90<=judge && judge<180)cout<<"safe"<<endl;
		else cout<<"warning"<<endl;
	}
	return 0;
}