QOJ.ac

QOJ

Time Limit: 30 s Memory Limit: 1024 MB Total points: 12

#24839. Centauri Prime

Statistics

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?

Input

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.

Output

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.

Constraints

$1 \le T \le 300$.

Test Set 1

Each country name will have between $3$ and $20$ letters.

Test Set 2

Each country name will have at most $100$ letters.

Examples

Input 1

3
Mollaristan
Auritania
Zizily

Output 1

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

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.