#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;
		double x,y;
		scanf("%d:%d", &h, &m);
		
		x = 30*h+m/2.0;
		y = m*6;
		
		if(x-30 < y && y < x+30){
			cout << "alert" << endl;
		}else if(x-390 < y && y < x-330){
			cout << "alert" << endl;
		}else if(x+330 < y && y < x+390){
			cout << "alert" << endl;
		}else if(x-90 < y && y < x+90){
			cout << "warning" << endl;
		}else if(x-470 < y && y < x-270){
			cout << "warning" << endl;
		}else if(x+270 < y && y < x+470){
			cout << "warning" << endl;
		}else{
			cout << "safe" << endl;
		}
		
	}
	
	return 0;
}