#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n){
        rep(i,n){
            double hour, mini;
            scanf("%lf%*c%lf", &hour, &mini);
            double angle = (hour * 300 + mini * 5) - (mini * 60);
            if(angle < 0) angle*= -1;
            if(angle > 1800) angle-= 1800;
            if(angle >= 0 && angle < 300)
                cout << "alert" << endl;
            else if(angle >= 900 && angle <= 1800)
                cout << "safe" << endl;
            else
                cout << "warning" << endl;
        }
    }
}