#include<iostream>
#include<cstdlib>

int main()
{
	int n;
	std::cin>>n;
	for(int i=0;i<n;i++)
	{
		char c;
		int h,m;
		
		std::cin>>h>>c>>m;
		
		int angl=h*60+m;
		int angs=m*12;

		int diff=abs(angl-angs);
		if(diff>360)diff=720-diff;
		
		if(diff<60)
		{
			std::cout<<"alert"<<std::endl;
		}
		else if(diff<180)
		{
			std::cout<<"warning"<<std::endl;
		}
		else
		{
			std::cout<<"safe"<<std::endl;
		}
	}
	return 0;
}