#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main(int argc, char const* argv[])
{
	int h,m;
	int n;

	cin >> n;

	for( int i = 0;i < n;i++ ){
		scanf("%d:%d",&h,&m);

		h *= 30;
		m *= 6;

		if( abs( h - m ) >= 0 && abs( h - m ) <= 30 ) cout << "alert" << endl;
		else if( abs( h - m ) >= 90 && abs( h - m ) <= 180 ) cout << "safe" << endl;
		else cout << "warning" << endl;
	}
	return 0;
}