#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
	int t,h;
	double n,ans;
	char c;
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%d%c%d",&h,&c,&t);
		ans=h*30+(0.5*double(t));
		ans-=t*6;
		ans=abs(ans);
		if(ans>180)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;
}