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

#define DEBUG(x) // cerr << #x << " = " << x << endl

const double EPS = 1e-8;

double deg_long(int hh, int mm) {
    hh %= 12;
    long double deg = (1.0 * 360) * hh / 12;
    deg += (1.0 * 360 / 12) * mm / 60;
}

double deg_short(int mm) {
    double deg = 1.0 * 360 * mm / 60;
}

int main() {
    int N; scanf("%d", &N);
    while(N--) {
        int hh, mm; scanf("%d:%d", &hh, &mm);
        double degA = deg_long(hh, mm);
        double degB = deg_short(mm);
        double diff = abs(degA - degB);
        diff = min(diff, abs((degA + 360) - degB));
        diff = min(diff, abs(degA - (degB + 360)));
        diff = min(diff, abs((degA + 360) - (degB + 360)));
        if (diff < 30 - EPS) puts("alert");
        else if(90 - EPS < diff) puts("safe");
        else puts("warning");
    }
}