#include <iostream>
#include <string>

std::pair<int, int> stot(const std::string &str) {
	auto idx = str.find(':');
	return std::make_pair<int, int>(stoi(str.substr(0, idx)), stoi(str.substr(idx + 1)));
}

int main() {
	int n;
	std::cin >> n;
	for (auto i = 0; i < n; ++i) {
		std::string arg;
		std::cin >> arg;
		auto time = stot(arg);
		auto hour = time.first * 60 + time.second, minute = time.second * 12;
		auto dist = (hour - minute) * (hour - minute);
		if (dist < 3600 || dist > 435600) {
			std::cout << "alert\n";
		}
		else if (dist < 32400 || dist > 291600) {
			std::cout << "warning\n";
		}
		else {
			std::cout << "safe\n";
		}
	}
	return 0;
}