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

int main() {
	int n, h, m;
	float a1, a2;
	
	cin >> n;
	for(int i=0;i<n;++i){
		scanf("%d:%d",&h,&m);
		
		a1 = fabs((h * 30 + m / 2 ) - 6 * m);
		a2 = 360 - a1;
		
		if(a1 < 30 || a2 < 30){
			cout << "alert" << endl;
		}else if((a1 <= 180 && a1 >= 90) || (a2 <= 180 && a2 >= 90)){
			cout << "safe" << endl;
		}else{
			cout << "warning" << endl;
		}
	}
	
	return 0;
}