#include <iostream>

using namespace std;

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