#include<iostream>
using namespace std;

int main()
{
	int n;
	double t, m;
	double AngleT = 360.0/12.0;
	double AngleT2 = 360.0/12.0/60.0;
	double AngleM = 360.0/60.0;
	double dif;
	cin>>n;
	while (scanf("%lf:%lf",&t,&m) != EOF) {
		dif = t*AngleT + m*AngleT2 - m*AngleM;
		if (dif<0.0) dif*=-1;
		if (dif>180.0)dif -= 360.0;
		if (dif<0.0) dif*=-1;
		if (dif<30.0) cout<<"alert"<<endl;
		else if (dif<90.0) cout<<"warning"<<endl;
		else cout<<"safe"<<endl;
	}
	return 0;
}