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

const double pi = 3.14159265358979;

int main(){
	int n;
	scanf("%d", &n);
	for(int i=0 ; i < n ; i++ ){
		int h, m;
		scanf("%d:%d", &h, &m);
		double hour_hand = (double)h / 6.0 * pi + m / 360.0 * pi + 2.0*pi ;
		double minute_hand = (double)m / 30.0 * pi + 2.0 * pi;
		double d = fabs( hour_hand - minute_hand );
		//cout << "h : " << (int) hour_hand / (2.0*pi) * 360 - 360 << endl;
		//cout << "m : " << (int) minute_hand / (2.0*pi) * 360 - 360 << endl;
		//cout << "d : " << (int) d / (2.0*pi) * 360 << endl;
		if( d < pi / 6.0 ){
			cout << "alert" << endl;
		}else if( d < pi / 2.0 ){
			cout << "warning" << endl;
		}else{
			cout << "safe" << endl;
		}
	}
}