#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

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

	double h, m;
	while (n--){
		scanf("%lf:%lf", &h, &m);
		double hh = 30 * h + 0.5 * m;
		double mm = 6 * m;
		// printf("hour angle %Lf\n", hh);
		// printf("minute angle %Lf\n", mm);
		double diff = abs(hh - mm);
		if (180 < diff) diff = 360 - diff;
		// cout << diff << endl;
		if (0 <= diff && diff < 30){
			cout << "alert" << endl;
		}
		else if (90 <= diff && diff <= 180){
			cout << "safe" << endl;
		}
		else {
			cout << "warning" << endl;
		}
	}

	return 0;
}