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

int main(void){
	int n;
	double h,m;
	double ans;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lf:%lf",&h,&m);
		h=h*30+m/2;
		m=m*6;
		if(h>m)ans=h-m;
		else ans=m-h;
		if(ans<30 || ans>330)cout << "alert" << endl;
		else if(90<=ans && ans<=270)cout << "safe" << endl;
		else cout << "warning" << endl;
	}
    return 0;
}