#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int n;
    cin >> n;

    while(--n >= 0){
        int h, m;
        char c;
        cin >> h >> c >> m;

        int a = abs(60 * h - 11 * m);
        if(a < 30*2 || a > 330*2)
            cout << "alert" << endl;
        else if(90*2 <= a && a <= 270*2)
            cout << "safe" << endl;
        else
            cout << "warning" << endl;
    }

    return 0;
}