#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n; cin >> n;
	rep(i, n) {
		double h, m; scanf("%lf:%lf", &h, &m);
		double d = abs(h * 30 - 5.5 * m);
		if (0. <= d&&d < 30.)puts("alert");
		else if (90. <= d&&d <= 180.)puts("safe");
		else puts("warning");
	}
}