// 2011/10/02 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	int n;
	cin >> n;

	for(int i=0; i<n; i++){
		string str;
		cin >> str;
		str[2] = ' ';

		istringstream is(str);
		int hh, mm;
		is >> hh >> mm;

		double L = mm*6.0;
		double S = hh*30.0+mm/2.0;

		if(L<S){
			double tmp = L;
			L = S;
			S = tmp;
		}

		double A;
		if(L-S>180.0)
			A = (S+360.0)-L;
		else
			A = L-S;

		if(A>=0.0&&A<30)
			cout << "alert" << endl;
		else if(A>=90.0&&A<=180.0)
			cout << "safe" << endl;
		else
			cout << "warning" << endl;
	}

	return 0;
}