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

double degree(int h, int m) {
	double s = m * 6;
	double l = h * 30 + m * 0.5;
	double d = abs(l - s);
	if (d >= 180) d -= 180;
	return d;
}

string judge(int h, int m) {
	double d = degree(h, m);
	if (d < 30) return "alert";
	else if (d < 90) return "warning";
	return "safe";
}

int main() {
	int n; cin >> n;
	while (n--) {
		int h, m; char d;
		cin >> h >> d >> m;
		cout << judge(h, m) << endl;
	}
	return 0;
}