#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){

	int n, h, m;
	double deg_l, deg_s, deg;
	string str;

	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> str;
		
		h = (str[0] - '0') * 10 + (str[1] - '0');
		m = (str[3] - '0') * 10 + (str[4] - '0');
		deg_l = 360.0 * (m / 60.0);
		deg_s = 360.0 * (h / 12.0) + 30.0 * (m / 60.0);
		
		deg = min(abs(deg_l - deg_s), 360.0 - abs(deg_l - deg_s));
		
		if(deg < 30.0) cout << "alert" << endl;
		else if(deg < 90.0) cout << "warning" << endl;
		else cout << "safe" << endl;
	}

	return 0;

}