#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	int h,m;
	int n;
	double l,s;
	double mi = 0;
	cin >> n;
	while(n--){
		mi = (1<<21);
		scanf("%d:%d",&h,&m);
		l = m * 0.5 + h * 30.0;
		s = m * 6 ;
		mi = min(mi,fabs(l-s));
		if(l>s)s+=360.0;
		else   l+=360.0;
		mi = min(mi,fabs(l-s));
		
		if(mi<30.0){
			cout << "alert" << endl;
		}else if(mi<90.0){
			cout << "warning" << endl;
		}else{
			cout << "safe" << endl;
		}
	}
}
		