#include<iostream>
#include<ios>
#include<algorithm>
using namespace std;
int n;
main()
{
	cin>>n;
	for(;n--;)
	{
		int h,m;
		scanf("%d:%d",&h,&m);
		double dm=m*6;
		double dh=h*30+m*1./2;
		double a=abs(dm-dh);
		cout<<(a<30?"alert":a>=90?"safe":"warning")<<endl;
	}
}

