#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

double AB(double num){
	if(num<0)num*=(-1);
	return num;
}

int main(){
	int n,h,m;
	double hh,mm,d;
	for(cin>>n;n>0;n--){
		scanf("%d:%d",&h,&m);
		
		
		mm=360.0*(double)m/60.0;
		hh=360.0*((double)h*60.0+(double)m)/720.0;
		d=AB(hh-mm);
		if(d>180)d=360-d;
		if(d<30)printf("alert\n");
		else if(d>=90)printf("safe\n");
		else printf("warning\n");
	}
	
	return 0;
}
