#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

vector<string>a(vector<string>b) {
	vector<string>ans(8, string(8, 'a'));
	for (int i = 0; i < 8; ++i) {
		for (int j = 0; j < 8; ++j) {
			ans[7 - j][i] = b[i][j];
		}
	}
	return ans;
}

int main() {
	int N; cin >> N;
	while (N--) {
		int h, m;
		scanf("%d:%d", &h, &m);
		m = h * 60 + m;
		int ans = 11*m;
		ans %= 720;
		if (ans >= 360)ans = 720 - ans;
		if (ans < 60)cout << "alert" << endl;
		else if(ans < 180)cout << "warning" << endl;
		else cout << "safe" << endl;
	}
	return 0;
}