#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int n, h, m, v; char dm;
	cin >> n;
	for(int i=0; i<n; ++i) {
		cin >> h >> dm >> m;
		v = abs(60*h-11*m); if(v>360) v=720-v;
		cout << (v<60?"alert":180<=v&&v<=360?"safe":"warning") << endl;
	}
	return 0;
}