#include <iostream>
#include <cstdio>
#include <cmath>

int main()
{
	int n; std::cin >> n;
	for (int i=0; i<n; i++) {
		int h, m;
		scanf("%d:%d", &h, &m);
		float dh = 30.0 * (float)h + 0.5 * (float)m;
		float dm = 6.0 * (float)m;
		float d = std::abs(dm - dh);
		if ((0.0 <= d && d < 30.0) || (330.0 < d && d <= 360.0)) std::cout << "alert" << std::endl;
		else if ((30.0 <= d && d < 90.0) || (270.0 < d && d <= 330.0)) std::cout << "warning" << std::endl;
		else std::cout << "safe" << std::endl;
	}
	
	return 0;
}


