#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n,h,m;
char com;
double s,l;

int main(){
	cin>>n;
	while(cin>>h>>com>>m){
		s=6.0*m;
		l=0.5*(h*60+m);
		double a=l-s;
		if(a<0)a*=-1;
		a=min(a,360.0-a);
		if(a<30)cout<<"alert"<<endl;
		else if(a<90)cout<<"warning"<<endl;
		else cout<<"safe"<<endl;
	}
}