#include<iostream>

using namespace std;

int main(void){
	int n;
	
	cin>> n ;
	for(int i = 0 ; i < n ; i++){
		int a,b; char c;
		int judge;
		
		cin>>a>>c>>b;
//		cout<<a<<" "<<b<<endl;
		b*=360/60;
		a=a*360/12;
		judge=(a-b)%180;
	
		if(judge<0)judge=-1*judge;
//		cout<<judge<<endl;
	
//		cout<<a<<" "<<b<<" "<<judge<<endl;
		if(judge<30)cout<<"alert"<<endl;
		else if(judge<90)cout<<"warning"<<endl;
		else cout<<"safe"<<endl;
	}

}