This page is still under construction.

Parts of this page are still being built. What you see may change.

Rulers of Centauri Prime

Time limit5sMemory limit512 MB

Summary
Given T country names, report for each whether a king, a queen, or nobody rules it from its last letter.
Level

Easy1 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Before the mighty Centauri Republic was founded, the planet Centauri Prime was split into several independent kingdoms. The kingdom of Mollaristan was ruled by king Loatold, and the kingdom of Auritania was ruled by queen Elana. In fact, every kingdom whose name ended in a consonant was ruled by a king, and every kingdom whose name ended in a vowel was ruled by a queen. By another coincidence, every kingdom whose name ended in the letter y was in constant turmoil and was ruled by nobody.

So the last letter of the name decides everything: y means nobody rules, one of the vowels a, e, i, o, u means a queen rules, and any other consonant means a king rules. Given several country names, write a program that reports the current ruler of each country.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains the name of one country. Country names consist of English letters only, with a capital first letter and lower case letters after it. No line contains any other character, and there are no empty lines.

Output

For each test case, print one line in the format Case #x: C is ruled by Y., where xx is the case number starting from 1, CC is the country name from the input, and YY is one of a king, a queen or nobody.

Capitalization and the terminating period must match this format exactly.

Constraints

  • 1≤T≤3001 \le T \le 300
  • Each country name has between 3 and 20 letters.

Examples6

  1. Example 1

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

    Input
    1
    Abc
    
    Expected output
    Case #1: Abc is ruled by a king.
    
  3. Example 3

    Input
    5
    Ala
    Ele
    Ili
    Olo
    Ulu
    
    Expected output
    Case #1: Ala is ruled by a queen.
    Case #2: Ele is ruled by a queen.
    Case #3: Ili is ruled by a queen.
    Case #4: Olo is ruled by a queen.
    Case #5: Ulu is ruled by a queen.
    
  4. Example 4

    Input
    4
    Zizy
    Kyy
    Yny
    Chovaultyy
    
    Expected output
    Case #1: Zizy is ruled by nobody.
    Case #2: Kyy is ruled by nobody.
    Case #3: Yny is ruled by nobody.
    Case #4: Chovaultyy is ruled by nobody.
    
  5. Example 5

    Input
    3
    Abcdefghijklmnopqrst
    Abcdefghijklmnopqrsu
    Abcdefghijklmnopqrsy
    
    Expected output
    Case #1: Abcdefghijklmnopqrst is ruled by a king.
    Case #2: Abcdefghijklmnopqrsu is ruled by a queen.
    Case #3: Abcdefghijklmnopqrsy is ruled by nobody.
    
  6. Example 6

    Input
    5
    Ryhtym
    Xyzzya
    Myrrhy
    Ayaya
    Yyy
    
    Expected output
    Case #1: Ryhtym is ruled by a king.
    Case #2: Xyzzya is ruled by a queen.
    Case #3: Myrrhy is ruled by nobody.
    Case #4: Ayaya is ruled by a queen.
    Case #5: Yyy is ruled by nobody.