#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n;

	while( cin >> n ){
		for( int i = 0; i < n; ++i ){
			int h, m;
			char dummy;
			cin >> h >> dummy >> m;

			int hAngle = h * 300 + m * 10 / 4;
			int mAngle = m * 10 * 360 / 60;
			int angle = hAngle - mAngle;
			string message;
			if( angle < 300 && angle > -300 ){
				message = "alert";
			}else if( ( angle >= 900 && angle <= 2700 ) || ( angle <= -900 && angle >= -2700 ) ){
				message = "safe";
			}else{
				message = "warning";
			}

			cout << message << endl;
		}
	}

	return 0;
}