#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

int main(){
    int n;
    scanf("%d\n",&n);
    for(int ix=0;ix<n;ix++){
        int h,m;
        scanf("%d:%d\n",&h,&m);
        int tan=(60*h+m)%720,tyo=(12*m)%720,dist=min(abs(tan-tyo),720-abs(tan-tyo));
        if(dist<60) printf("alert\n");
        else if(180<=dist) printf("safe\n");
        else printf("warning\n");
    }
}