#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
	long n;
	cin>>n;
	for(int i=0;i<n;i++){
		int hh,mm;
		char cc;
		cin>>hh>>cc>>mm;
		double tyousin=mm*6;
		double tansin=hh*30+mm*0.5;
		double sita=abs(tyousin-tansin);
		if(sita>180)sita=360-sita;
		if(0<=sita &&sita<30)cout<<"alert"<<endl;
		else if(sita>=90 && sita<=180)cout<<"safe"<<endl;
		else cout<<"warning"<<endl;
	}
	return 0;
}