#include <iostream>
#include <cmath>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		int h, m;
		char c;
		cin >> h >> c >> m;
		double hour_hand = h * 30 + m / 2;
		double minute_hand = m * 6;
		double min_diff = min(fabs(hour_hand - minute_hand), 360 - fabs(hour_hand - minute_hand));
		if(min_diff < 30)
		{
			cout << "alert" << endl;
		}
		else if(min_diff < 90)
		{
			cout << "warning" << endl;
		}
		else
		{
			cout << "safe" << endl;
		}
	}
}

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