#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-6;

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	while (n--)
	{
		int h, m;
		scanf("%d:%d", &h, &m);
		double tm = 360.0 * m / 60.0;
		double th = 360.0 * (h / 12.0 + m/60.0/12.0);
		double t = abs(th - tm);
		if (t > 180)
			t = 360 - t;

		if (t < 30)
			puts("alert");
		else if (t < 90)
			puts("warning");
		else
			puts("safe");
	}

	return 0;
}