#include <iostream>
#include <cmath>

using namespace std;

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

	long double h, m;
	while (n--){
		scanf("%Lf:%Lf", &h, &m);
		long double hh = 360 * (h / 12);
		long double mm = 360 * (m / 60);
		long double diff = abs(hh - mm);
		// 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;
}