#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
//#define int long long
#define rep(i, n) for (int i=0; i<n; i++)
#define REP(n) rep(i, n)
using namespace std;

int n, hh, mm; 
char colon;
float tansin, tyousin, sa; 

signed main()
{
    cin >> n;

    REP(n)
    {   
        cin >> hh >> colon >> mm; 
        //printf("hh = %d, mm = %d\n", hh, mm);

        tansin = 30.0 * hh + 0.5 * mm; 
        tyousin = 6.0 * mm; 

        float saki = fmax(tansin, tyousin);
        float ato = fmin(tansin, tyousin);

        sa = fmin(saki - ato, 360.0 - saki + ato);
        //printf("sa = %f\n", sa);

        if (0.0 <= sa && sa < 30.0)
        {   
            cout << "alert" << endl;
        } else if (90.0 <= sa && sa <= 180.0) {
            cout << "safe" << endl;
        } else {
            cout << "warning" << endl;
        }   
    }   

    return 0;
}