#include <iostream>
#include <cmath>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i)
	{
		int h, m;
		scanf("%d%*c%d", &h, &m);
		double theta_l = h * 30 + (double)m / 2;
		double theta_s = m * 6;
		double theta = fabs(theta_l - theta_s);
		if(theta > 180)
		{
			theta = 360 - theta;
		}
		if(0 <= theta && theta < 30)
		{
			cout << "alert" << endl;
		}
		else if(30 <= theta && theta < 90)
		{
			cout << "warning" << endl;
		}
		else
		{
			cout << "safe" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}