import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	auto n = readln.chomp.to!int;
  while (n--) {
    auto x = readln.chomp.split(":").map!(to!double);
    auto diff = abs((x[0]+x[1]/60) * 30 - x[1] * 6);
    diff = min(diff, 360 - diff);
    if (diff < 30) {
      writeln("alert");
    } else if (diff < 90) {
      writeln("warning");
    } else {
      writeln("safe");
    }
  }
}