#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main() {

  int n;
  cin>> n;
  while(n--) {
    int l_hand, s_hand;
    double l_angle, s_angle;
    double angle;

    scanf("%d:%d",&l_hand, &s_hand);
    l_angle = (double)l_hand*30 + (double)s_hand*0.5;
    s_angle = (double)s_hand*6;
    angle = abs(l_angle-s_angle);

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