#include<iostream>
#include<ios>
#include<algorithm>
using namespace std;
int n;
int main()
{
	cin>>n;
	for(;n--;)
	{
		int h,m;
		scanf("%d:%d",&h,&m);
		int dm=m*12;
		int dh=h*60+m;
		int a=abs(dm-dh);
		if(a>360)a=720-a;
		cout<<(a<60?"alert":a>=180?"safe":"warning")<<endl;
	}
}
