#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
	int n;cin>>n;
	for(int i=0;i<n;i++)solve();
}
void solve(){
	int a,b;
	scanf("%d:%d",&a,&b);
	double d=abs((a*30+(double)b/2)-b*6);
	d=min(d,360-d);
	if(d<30)cout<<"alert\n";
	else if(d<90)cout<<"warning\n";
	else cout<<"safe\n";
	return;
}