#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
	double n,h,t,ans;
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%d:%d",&h,&t);
		h=h*30+(0.5*t);
		t=t*6;
		if(h<t)swap(h,t);
		ans=h-t;
		if(ans>180)ans=ans-180;
		if(0.0<=ans&&ans<=30.0){
			cout<<"alert"<<endl;
		}else if(90.0<=ans&&ans<180.0){
			cout<<"safe"<<endl;
		}else{
			cout<<"warning"<<endl;
		}
	}
	return 0;
}