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

int n,hh,mm;

int main(){
	scanf("%d",&n);
	for(int t = 0; t < n; t++){
		scanf("%d:%d",&hh,&mm);
		int rm = mm*12;
		int rh = hh*60+mm;
		int r = fabs(rm-rh);
		if(r < 30*2 || r > 330*2){
			puts("alert");
		}
		else if(r >= 90*2 && r <= 270*2){
			puts("safe");
		}
		else{
			puts("warning");
		}
	}

	return 0;
}

