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

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        char input[6];
        cin >> input;
        int timeM = (input[0] - '0') * 600 + (input[1] - '0') * 60 + (input[3] - '0') * 10 + (input[4] - '0');
        double littleHand = 6 * (timeM % 60);
        double bigHand = 0.5 * timeM;
        double angle = fabs(littleHand - bigHand);
        if (angle < 30 || 330 < angle) {
            cout << "alert" << endl;
        } else if (90 <= angle && angle <= 270) {
            cout << "safe" << endl;
        } else {
            cout << "warning" << endl;
        }
    }
}