#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define min(x, y) ((x) < (y) ? (x) : (y))
int main()
{
	int n; scanf("%d", &n);
	rep(i, n) {
		int h, m; scanf("%d:%d", &h, &m);
		double ah = 0.5 * (60 * h + m);
		double am = 6.0 * m;
		double d = fabs(ah - am);
		d = min(d, 360.0 - d);

//printf("%02d:%02d, %4.1f %4.1f, d=%.1f ", h, m, 0.5 * ah, 0.5 * am, d);
		if (d < 30) puts("alert");
		else if (d < 90) puts("warning");
		else puts("safe");
	}
	return 0;
}