#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int n;
	int hour,minute;
	char d;
	double kakuh,kakum,sa;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> hour >> d >> minute;
		kakuh = 30.0 * hour + minute * 0.5;
		kakum = 6.0 * minute;
		sa = abs(kakuh-kakum);
		if (sa > 180.0) {
			sa = sa - 180;
		}
		if (sa <30.0) {
			cout << "alert" << endl;
		} else if (sa >= 90.0) {
			cout << "safe" << endl;
		} else {
			cout << "warning" << endl;
		}
	}
	return 0;
}