#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
	int n;
	cin>>n;
	rep(i,n){
		char ch;
		int h,m;
		cin>>h>>ch>>m;


		if(330<abs(30*h+h/2.0-6*m) || abs(30*h+h/2.0-6*m)<30)cout<<"alert"<<endl;
		else if(90<=abs(30*h+h/2.0-6*m) && abs(30*h+h/2.0-6*m)<=270)cout<<"safe"<<endl;
		else cout<<"warning"<<endl;
	}
	return 0;
}