#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int n;
	double a,b,d;
	char c;
	cin >> n;
	for (;n>0;n--) {
	scanf("%lf%c%lf",&a,&c,&b);
	a= a>=12 ? a-12 : a;
	a=a*30+b*0.5; b*=6;
	if (a>b) { d=a; a=b; b=d;}
	b-=a;
	b= b>180 ? 360-b : b;
	if (b<30) cout << "alert" << endl; else
		if (b>=90) cout << "safe" << endl; else cout << "warning" << endl;
	}
return 0;
}