#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int n; cin >> n;
    double h, m;
    char t;
    double lv, sv;
    REP(n)
    {
        cin >> h >> t >> m;
        lv = m * 360 / 60;//[deg]

        sv = (h * 360 / 12) + m * 15 / 60;
        
        double dd = fabs(lv - sv);
        if(dd > 180) dd = 360 - dd;
        if(fabs(dd) < 30) { cout << "alert" << endl; continue;}
        if(fabs(dd) < 90) { cout << "warning" << endl; continue;}
        cout << "safe" << endl;
    }

    return 0;
}