#include <math.h>
#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int n,h,m;
double rh, rm, r;

int main(){
	cin >> n;
	for (int t = 0; t < n; t++) {
		scanf(" %d:%d", &h, &m);
		rh = h * 30 + m * 0.5;
		rm = m * 6;
		r = abs(rh - rm);
		if (r < 30 || r > 330) {
			cout << "alert" << endl;
		}
		else if(r >= 90 && r <= 180) {
			cout << "safe" << endl;
		}
		else {
			cout << "warning" << endl;
		}
	}

	return 0;
}