#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> h(n);
	vector<int> m(n);
	vector<string> s(n);
	char co;
	for(int i=0;i<n;i++){
		double d=0;
	cin>>h[i]>>co>>m[i];
		d=double(360)/12*h[i];
		d+=double(360)/12/60*m[i];
		d-=double(360)/60*m[i];
		d=abs(d);
		if(d<30)
			s[i]="alert";
		else if(d>=90&&d<180)
			s[i]="safe";
		else
			s[i]="warning";
	}
	
	for(int i=0;i<n;i++)
		cout<<s[i]<<endl;
	
	

}

	