#include <cstdio>
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main()
{
	int n; scanf("%d", &n);
	rep(i, n) {
		int h, m; scanf("%d:%d", &h, &m);
		int ah = 60 * h + m;
		int am = 12 * m;
		int diff = ah - am; if (diff < 0) diff = -diff;
		if (diff > 360) diff -= 360;

		double d = 0.5 * diff;
		if (d < 30) puts("alert");
		else if (d < 90) puts("warning");
		else puts("safe");
	}
	return 0;
}