#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	int n;
	scanf("%d", &n);
	rep(i, n){
		int h, m;
		scanf("%d:%d", &h, &m);
		
		double arg = fabs(h*5 + m/12.0 - m);
		if(arg >= 30.0)
			arg = 60.0 - arg;
		if(arg < 5.0)
			puts("alert");
		else if(arg < 15.0)
			puts("warning");
		else
			puts("safe");
	}
	
	return 0;
}