#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
int main(void)
{
	int n,h,m,a;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d:%d",&h,&m);
		h=h*60+m;
		m*=12;
		a=std::min(abs(h-m),std::min(abs(h+720-m),abs(h-720-m)));
		if(a<60)
			puts("alert");
		else if(a>=180)
			puts("safe");
		else puts("warning");
	}
	return 0;
}