#include <iostream>
#include <cmath>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

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

	rep(i,n)
	{
		double a,b;
		char c;
		cin >> a >> c >> b;

		double d = a*5 + b/12.0;	
		if(fabs(d-b) <= 5)
		{
			cout << "alert" << endl;
		}
		else if(15 < fabs(d-b) && fabs(d-b) < 30)
		{
			cout << "safe" << endl;
		}
		else if(d > b){
			double temp = fabs((60-d)-b);
			if(temp < 5)
			{
				cout << "alert" << endl;
			}
			else if(15 < temp && temp < 30)
			{
				cout << "safe" << endl;
			}
			else
			{
				cout << "warning" << endl;
			}
		}
		else if(d < b)
		{
			double temp = fabs((60-b)-d);
			if(temp < 5)
			{
				cout << "alert" << endl;
			}
			else if(15 < temp && temp < 30)
			{
				cout << "safe" << endl;
			}
			else
			{
				cout << "warning" << endl;
			}
		}
	}
	return 0;
}