#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.clock", "r", stdin );

	const string mesg[] = { "alert" ,"warning" ,"safe" };
	const double range[] = { 0.0, 30.0, 90.0, 180.0 }; 
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i,j;
	for (i = 0; i < n; ++i){
		getline (cin, str );
		str = str.replace(str.find(':'), 1, " ");
		int hour, minute;

		stringstream ss(str);
		ss >> hour >> minute;
		double hour_arg = 30.*hour + minute/2.;
		double minute_arg = 6.*minute;
		double diff = fabs (hour_arg - minute_arg );
		diff = min (diff, 360. - diff ); 
//		cout << "hour_arg  : " << hour_arg << endl;
//		cout << "mintue_arg: " << minute_arg << endl;
//		cout << "diff:       " << diff << endl;

		for (j = 0; j < 3; ++j){
			if (diff >= range[j] && diff < range[j+1]){
				cout << mesg[j] << endl;
				break;
			} // end if
		} // end for
	} // end loop
		
	return 0;
}