#include <iostream>
#include <cmath>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main() {
	int n, h, m;
	char c;
	cin >> n;
	rep(i,n) {
		cin >> h >> c >> m;
		double x = 30.0*(h+m/60.0);
		double ret = abs(x-6*m) < 180 ? abs(x-6*m) : 360-abs(x-6*m);
		if(0 <= ret && ret < 30) cout << "alert" << endl;
		else if(90 <= ret && ret <= 180) cout << "safe" << endl;
		else cout << "warning" << endl;
	}
	return 0;
}