#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		int h;
		int m;
		double shortHand, longHand;
		double deg;
		cin>>h;cin.ignore(1);cin>>m;
		longHand = m*6;
		shortHand = 30*h+0.5*m;
		deg = fabs(shortHand-longHand);
		if(deg>180.0)
			deg = 360.0-deg;
		if(deg<30.0){
			cout<<"alert\n";
		}else if(deg>=90.0&&deg<=180.0){
			cout<<"safe\n";
		}else{
			cout<<"warning\n";
		}
	}
	return 0;
}