#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int n;
	cin >> n;
	rep(q, n){
		string s;
		cin >> s;
		int h, m;
		h = stoi(s.substr(0, 2)); m = stoi(s.substr(3, 2));
		double a, b;
		a = 360/(60./m); b = 360/(12./h) + 30/(60./m);
		if(abs(a-b) < 30) cout << "alert" << endl;
		else if(abs(a-b) < 90) cout << "warning" << endl;
		else cout << "safe" << endl;
	}
}