#include<iostream>
#include<cmath>
using namespace std;
int a, b, n;
double d, e, f;
char c;
int main() {
	cin >> n;
	while (cin >> a >> c >> b) {
		d = b * 6;
		e = (a * 60 + b) / 2;
		f = abs(d - e);
		if (f > 180) { f = 360 - f; }
		if (f < 30) { cout << "alert" << endl; }
		else if (f < 90) { cout << "warning" << endl; }
		else { cout << "safe" << endl; }
	}
}