#include<iostream>
using namespace std;

int main() {
	int n;
	double h, m;
	double ha, ma;
	double x;
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%lf:%lf", &h,&m);
		ha = 30 * h + (m / 2);
		ma = m * 6;
		x = ma - ha;
		if (x < 0) { x*= -1;}
		if (x > 180) {
			x*=-1;
		x += 360;
		}
		if (x >= 0 && x < 30) { cout << "alert" << endl; }
		else if (x >= 90 && x <= 180) { cout << "safe" << endl; }
		else { cout << "warning" << endl; }
	}
	return 0;
}