#include<iostream>
#include<cstdio>
using namespace std;


int main(void)
{
	//入力変数(時間)
	int time = 0;
	//入力分変数
	int min = 0;
	//入力回数
	int n = 0; 

	cin >> n;

	//出力
	for (int i = 0; i < n; i++)
	{
		scanf("%d:%d" , &time , &min);

		time *= 5;

		time += min / 12;

		//両方足す(負数になると面倒)
		time += 60;
		min += 60;

		if (time + 5 > min && time - 5 < min)
		{
			cout << "alert";
		}
		else if (time + 15 <= min && time + 30 >= min || time - 15 >= min && time -30 <= min)
		{
			cout << "safe";
		}
		else
		{
			cout << "warning";
		}
		cout << endl;
	}

	return 0;
}