#include <stdio.h>
#include <algorithm>
using namespace std;
int n, h, m, r, a;
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		scanf("%02d:%02d", &h, &m); r = h * 60 + m; m *= 12;
		a = min(abs(r - m), 720 - abs(r - m));
		if(a < 60) printf("alert\n");
		else if(a < 180) printf("warning\n");
		else printf("safe\n");
	}
}