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

int main(){
    int n;
    int hour, minute;

    cin >> n;

    for(int i=1; i<=n; i++){
        scanf("%d:%d", &hour, &minute);
        double hour_angle;
        double minute_angle;

        minute_angle = minute * 6.0;
        if(minute_angle == 360.0){
            minute_angle = 0.0;
        }
        hour_angle = (hour * 60.0 + minute) * 360.0 / (12.0 * 60.0);
        if(hour_angle == 360.0){
            hour_angle = 0.0;
        }

        double diff = abs(minute_angle - hour_angle);
        if(diff > 180.0){
            diff = 360.0 - diff;
        }

        if(0<= diff && diff < 30){
            cout << "alert" << endl;
        }else if(90<= diff && diff <= 180){
            cout << "safe" << endl;
        }else{
            cout << "warning" << endl;
        }
    }
    return 0;
}