#include<iostream>
#include<string>
using namespace std;

double max( double a, double b )
{
    if( a > b )
        return a;
    else
        return b;
}

int main()
{
    int n;
    double a, b;
    string s;

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> s;
        a = ( s[0] - '0' ) * 10 + ( s[1] - '0' );
        b = ( s[3] - '0' ) * 10 + ( s[4] - '0' );
        a = a * 30 + b * 0.5;
        b *= 6;
        double diff = max( a - b, b - a );
        
         if( diff > 180 )
             diff = 360 - diff;

        if( 0 <= diff && diff < 30 )
            cout << "alert" << endl;
        else if( 90 <= diff && diff <= 180 )
            cout << "safe" << endl;
        else
            cout << "warning" << endl;
    }

    return 0;
}
