#include <cstdio>
#include <algorithm>

using namespace std;

int h, m;

void solve(){
    // ツ陳キツ針
    double l = m * 6;
    
    // ツ短ツ針
    double s = h * 30 + m / 2.0;
    
    if(l < s){
        swap(l, s);
    }
    
    // ツ角ツ度ツづーツ仰づ淞づゥ
    double diff = min(l - s, s - l + 360);
    
    if(diff < 30){
        printf("alert\n");
    }
    
    else if(diff < 90){
        printf("warning\n");
    }
    
    else {
        printf("safe\n");
    }
}

int main(){
    int n;
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; ++i){
        scanf("%d:%d", &h, &m);
        solve();
    }
    
    return 0;
}