#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	double h, m;
	char c;
	double a, b, d;
	for (int i = 0; i < n; i++) {
		cin >> h >> c >> m;
		b = 360.0 * m / 60.0;
		a = (360.0 * h / 12.0) + (30.0 * m / 60.0);
		d = fabs(a-b);
		if (d < 30.0) {
			cout << "alert" << endl;
		} else if (d >= 90.0) {
			cout << "safe" << endl;
		} else {
			cout << "warning" << endl;
		}
	}
	return 0;
}