#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


const string ALERT = "alert";
const string SAFE = "safe";
const string WARNING = "warning";

string solve( string s ) {
    replace( s.begin(), s.end(), ':', ' ' );
    ISS iss( s );
    int hh, mm;
    iss >> hh >> mm;

    double ang1 = ( hh * 60.0 + mm ) / 720.0 * 360.0;
    double ang2 = mm / 60.0 * 360.0;
    double diff = fabs( ang1 - ang2 );

    if ( diff > 180.0 ) diff = 360.0 - diff;
    if ( diff > 0.0 || fabs( diff ) < 1e-9 ) {
        if ( diff < 30.0 || fabs( diff - 30.0 ) < 1e-9 ) return ALERT;
    }
    if ( diff > 90.0 || fabs( diff - 90.0 ) < 1e-9 ) {
        if ( diff < 180.0 || fabs( diff - 180.0 ) < 1e-9 ) return SAFE;
    }
    return WARNING;
}

int main() {
    int n;
    cin >> n;
    for ( int i = 0; i < n; ++ i ) {
        string s;
        cin >> s;
        cout << solve( s ) << endl;
    }
    return 0;
}