#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
 
 
const int INF = 1000000;
 
 
 int main(){
 	int k,n,m;
 	cin>>k;
 	for(int i = 0; i < k; i++){
 		scanf("%d:%d", &m, &n);
	 	m = m>12?m-12:m;
		double d = 360.0 * m / 12.0;
		d += 30.0 * n / 60.0;
		double e = 360.0 * n / 60.0;
		double f = min(abs(d-e),abs(360-abs(d-e)));
		
		if(f < 30.0) cout<<"alert"<<endl;
		else if(f >= 90.0) cout<<"safe"<<endl;
		else cout<<"warning"<<endl;
	}
 }