#include <iostream>
#include <cstdio>
#include <math.h>
int main(){
	//Input
	int N;
	std::cin >> N;

  double H, M;
	while(N--){
		scanf("%lf:%lf",&H,&M);
		//Processing
		//ツ角ツ度ツづーツ仰づ淞づゥ
		double aH = (60 * H + M) / 2, aM = 6 * M, a;
		//std::cout << aH << "," << aM << std::endl;
		a = std::min(fabs(aH-aM), 360-fabs(aH-aM));

		//ツ甘ォツ個ッツつウツづーツ板サツ津ィ
		std::string res;
		if(a < 30){
			res = "alert\n";
		}
		else if(a >= 90){
			res = "safe\n";
		}
		else{
			res = "warning\n";
		}

		std::cout << res;
	}
}