#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <cstdio>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()

using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int main(){
	int n;
	cin >> n;
	rep(i, n){
		int h, m;
		char c;
		cin >> h >> c >> m;
		int l = 60*h+m;
		int s = 12*m;
		if(l < s) swap(l, s);
		int dif = min(l-s, s-l+720);
		string mes;
		if(dif < 60) mes = "alert";
		else if(dif >= 180) mes = "safe";
		else mes = "warning";
		cout << mes << endl;
	}



    return 0;
}