#include<iostream>
#include<vector>
#include<string>
#include<math.h>
using namespace std;
double abvalue(double a,double b) {
	if ((a - b) > 0)return a - b;
	else return (a - b) * -1;
}
int main() {
	int n;
	enum safety{s,w,al};//safe,warning,alart
	vector<safety>l;
	cin >> n;
	for (int i = 0; i < n; i++){
		string ss;
		cin >> ss;
		int a, b;
		double c, d;
		a = (ss[0] - '0') * 10 + (ss[1] - '0');
		b = (ss[3] - '0') * 10 + (ss[4] - '0');
		c = a * 30 + b * 0.5;
		d = b * 6;
		if (abvalue(c, d) < 30)l.push_back(al);
		else if (abvalue(c, d) >= 90)l.push_back(s);
		else l.push_back(w);
	}
	for (safety i : l) {
		if (i == al)cout << "alert";
		else if (i == s)cout << "safe";
		else if (i == w)cout << "warning";
		cout << endl;
	}
	char cha;
	cin >> cha;
}