#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n; cin >> n;

	for (int i = 0;i < n;i++){
		char a[6]; cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
		double h = 10*(a[0]-'0') + (a[1]-'0');
		double m = 10*(a[3]-'0') + (a[4]-'0');
		double ha = 30 * h + m/2;
		double ma = 6 * m;
		double d = max(ha,ma) - min(ha,ma);
		if(d < 30 || d > 330) cout << "alert" << endl; 
		else if(d < 90 || d > 270) cout << "warning" << endl;
		else cout << "safe" << endl;
	}

	return 0;

}

