#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int h,m;
	char co;
	for(int i=0;i<n;i++){
		double d=0;
	cin>>h>>co>>m;
		d=double(360)/12*h;
		d+=double(360)/12/60*m;
		d-=double(360)/60*m;
		d=abs(d);
		if(d>=0&&d<30)
			cout<<"alert"<<endl;
		else if(d>=90&&d<180)
			cout<<"safe"<<endl;
		else
			cout<<"warning"<<endl;
	}
}