#include <cstdio>
#define abs(x) ((x) < 0 ? -(x) : (x))
#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 = h * 60 + m;
		int am = 12 * m;
		int diff = abs(ah - am);
		if (0 <= diff && diff < 60) puts("alert");
		else if (180 <= diff && diff <= 360) puts("safe");
		else puts("warning");
	}
	return 0;
}