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

int main() {
    int n;
    cin >> n;
    string s;
    while (n--) {
        cin >> s;
        int h = (s[0] - '0') * 10 + (s[1] - '0');
        int m = (s[3] - '0') * 10 + (s[4] - '0');
        if (abs(60 * h - 11 * m) < 60) {
            cout << "alert" << endl;
        } else if (abs(60 * h - 11 * m) < 180) {
            cout << "warning" << endl;
        } else {
            cout << "safe" << endl;
        }
    }
    return 0;
}