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