#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

signed main(){
	int N,H,M;
	cin>>N;
	for(int i=0;i<N;i++){
		scanf("%d:%d",&H,&M);
		double d;
		d = abs(360.0*((H%12)*60+M)/(12.0*60.0)-360.0*M/60.0);
		if(d>180.0) d = 360.0-d;
		if(d<30) puts("alert");
		else if(90<=d && d<=180) puts("safe");
		else puts("warning");
	}
	return 0;
}