#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n;
double a,b,ans;
int main(){
	cin>>n;
	rep(i,n){
		scanf("%lf:%lf",&a,&b);
		ans=abs(((a*60+b)*0.5 )-b*6);
		if(0<=ans&&ans<30.0){cout<<"alert"<<endl;}
		else if(90.0<=ans&&ans<=180.0){cout<<"safe"<<endl;}
		else{cout<<"warning"<<endl;}
	}
}