#include <iostream>

using namespace std;

int main()
{
	int n;
	float s, t;
	
	cin >> n;
	while(n--){
		scanf("%f:%f", &s, &t);
		
		s = s*30-5.5*t;
		if(s < 0){
			s = -s;
		}
		
		if(0 <= s && s < 30){
			cout << "alert" << endl;
		} else if(90 <= s && s <= 180){
			cout << "safe" << endl;
		} else {
			cout << "warning" << endl;
		}
	}
}