#include <bits/stdc++.h>

using namespace std;


int main() {
	int n, sh, lh;
	double degreeOfSh, degreeOflh, result;
	char c;

	cin >> n;
	while (n--) {
		cin >> sh >> c >> lh;
		//cout << sh << ends << lh << endl;
		degreeOfSh = sh * 30 + lh*0.5;
		degreeOflh = lh * 6;
		//cout << degreeOfSh << ends << degreeOflh << endl;
		result = min(fabs(degreeOfSh - degreeOflh), 360 - fabs(degreeOfSh - degreeOflh));
		if (result < 30) {
			cout << "alert" << endl;
		}
		else if (result >= 90 && result <= 270) {
			cout << "safe" << endl;
		}
		else {
			cout << "warning" << endl;
		}
	}

	return 0;
}

