#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

int main() {
	int n;
	cin >> n;
	while (n--) {
		int h, m;
		scanf("%d:%d", &h, &m);
		
		double angle1 = m * 6.0, angle2 = h * 30.0 + m / 2.0;
		double div = min(abs(angle1 - angle2), 360.0 - abs(angle1 - angle2));
		
		if (div >= 0 && div < 30.0)
			puts("alert");
		else if (div >= 90.0 && div <= 180.0)
			puts("safe");
		else
			puts("warning");
	}
	return 0;
}