#include <iostream>

using namespace std;

int main(void){
	int n;
	
	cin >> n;
	for(int i=0;i<n;i++){
		int hh,mm;
		double l,s,arg;
		cin >> hh;
		cin.ignore();
		cin >> mm;
		
		l = mm*6;
		s = hh*30+mm*0.5;
		l>s?arg = l-s:arg= s-l;
		
		if(arg > 180){
			arg = 360-arg;
		}
		if(arg < 30){
			cout << "alert" << endl;
		}else if(90 <= arg){
			cout << "safe" << endl;
		}else{
			cout << "warning" << endl;
		}
	}
}