#include<iostream>

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;
		
		b*=60;
		a=a*12+b*0.5;
		
	//	cout<<a<<" "<<b<<" "<<(a-b)%180<<endl;
		if((a-b)%180<0)cout<<"alert"<<endl;
		else if((a-b)%180==0)cout<<"warning"<<endl;
		else cout<<"safe"<<endl;
	}

}