#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)

typedef unsigned long long ull;

int main(){
	int n; cin>>n;
	FOR(i,n){
		int x,y;
		scanf("%d:%d",&x,&y);
		double h = (x * 60 + y) / (60.0 * 12) * 360.0;
		double m = y * 6.0;
		double df = abs(h-m);
		df = min(df,360-df);
		if(df < 30) puts("alert");
		else if(df >= 90) puts("safe");
		else puts("warning");
	}

	return 0;
}