#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<sstream>


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

#define PII pair<int,int>
#define PP pair< int,PII >


using namespace std;



int main(){
	int n;
	int h,m;
	scanf("%d", &n);
	rep(i,n){
		int flag = 0;
		scanf("%d:%d", &h, &m);
		h = 30*h;
		h += m/2;
		m = m*6;
		
		int ha = (h+330)%360;
		rep(i,61){
			if(ha%360 == m){
				flag = 1;
			}
			ha++;
		}
		
		int hs = (h+90)%360;
		rep(i,181){
			if(hs%360 == m){
				flag = 2;
			}hs++;
		}
		
		if(flag == 1){
			cout << "alert" << endl;
		}else if(flag == 2){
			cout << "safe" << endl;
		}else{
			cout << "warning" << endl;
		}
	}
	
	return 0;
}