#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int N;
	scanf("%d",&N);
	while(N--){
		double a,b;
		int h,m;
		scanf("%d:%d",&h,&m);
		b = m*6.0;
		a = h*30.0+m/2.0;
		double d = fabs(a-b);
		if(d < 30.0){
			puts("alert");
		}
		else if(90.0 <= d && d <= 180.0){
			puts("safe");
		}
		else{
			puts("warning");
		}
	}

    return 0;
}