#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n, h, m;

int main(){
	cin >> n;
	REP(i, n){
		scanf("%d:%d", &h, &m);
		double s = (double)h * 30.0 + (double)m*0.5, l = (double)m * 6.0;
		if (fabs(l - s) < 30)cout << "alert" << endl;
		else if (fabs(l - s) < 90)cout << "warning" << endl;
		else cout << "safe" << endl;
	}
}