#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

int n;
int h, m;
int main() {
  while (cin >> n) {
	for (int CA = 0; CA < n; ++CA) {
	  scanf("%d:%d", &h, &m);
	  int degh = 300*h+5*m;
	  int degm = 60*m;
	  int deg = min(abs(degh-degm), 3600-abs(degh-degm));
	  if (deg < 300) puts("alert");
	  else if (deg >= 900) puts("safe");
	  else puts("warning");
	}
  }
}
			 

