#include <iostream>
#include <cmath>
#include <algorithm>

#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 r = a*30 + b*6/12;
		double r2 = b*6;
		if(r2 < r) swap(r2,r);

		double rad = min(r2-r,360 - (r2-r));

		if(rad < 30) cout << "alert" << endl;
		else if(90 <= rad && rad <= 180) cout << "safe" << endl;
		else cout << "warning" << endl;
	}
	return 0;
}