시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB72632021238.899%

문제

Back in the old days before the creation of the mighty Centauri Republic, the planet Centauri Prime was split into several independent kingdoms. The kingdom of Mollaristan was ruled by king Loatold, while the kingdom of Auritania was under the rule of queen Elana. In fact, it just so happened that every kingdom whose name ended in a consonant was ruled by a king, while every kingdom whose name ended in a vowel was ruled by a queen. Also because of an amazing coincidence, all kingdoms whose named ended in the letter 'y' were constantly in a state of turmoil and were not ruled by anyone. Can you write a program that will determine the current rulers of several countries, given the countries' names?

입력

The first line of the input gives the number of test cases, T. T lines follow, each one containing the name of one country. Country names will consist of only lower case English letters, starting with a capital letter. There will be no other characters on any line, and no empty lines.

출력

For each test case, output one line containing "Case #x: C is ruled by Y.", where x is the case number (starting from 1), C is the country name, and Y is either "a king", "a queen" or "nobody".

Be careful with capitalization and the terminating period. Your output must be in exactly this format. See the examples below.

제한

  • 1 ≤ T ≤ 300.
  • Each country name will have at most 100 letters.

예제 입력 1

3
Mollaristan
Auritania
Zizily

예제 출력 1

Case #1: Mollaristan is ruled by a king.
Case #2: Auritania is ruled by a queen.
Case #3: Zizily is ruled by nobody.

채점 및 기타 정보

  • 예제는 채점하지 않는다.