#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cmath>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n; cin >> n;
    rep(i,n){
        int h,m;
        scanf("%d:%d",&h,&m);
        h=h*60+m;
        m*=720/60;
        int dt=min(abs(h-m),60*12-abs(h-m));
        // cout << dt << endl;
        string ans;
        if(dt<60*1) ans = "alert";
        else if(dt>=60*3) ans = "safe";
        else ans = "warning";
        cout << ans << endl;
    }
}