Under construction

Still being built. Things may change

ASCII Art

Interview

Time limit20sMemory limit1024 MB

Summary
Given N, find the N-th character printed by a program that prints each letter A to Z i times in round i, for i from 1 upward.
Level

Medium4 of 10

Topics
Math, Binary search
Solved
No attempts yet

Problem

Cody-Jamal has heard that generative artificial intelligence can produce art. He is excited about the new art opportunities, but worried that human-made art may be displaced. He thinks a good compromise is to use computers to create art that humans cannot make.

Cody-Jamal is just starting with computer-generated art, so he started simple. He wants to create an immense string that shows the English alphabet in a doubly-repeated way, to represent its ubiquity and permanence.

Cody-Jamal wrote the following program:

for i = 1 to 1e100:
  for letter = A to Z:
    print letter i times

Here 1e100 represents the integer 1010010^{100}. For example:

  • When i=1i=1, the program prints ABCD....XYZ.
  • When i=2i=2, the program prints AABBCC...XXYYZZ.
  • When i=3i=3, the program prints AAABBBCCC...XXXYYYZZZ.

Of course, Cody-Jamal's program takes a long time to finish. Can you help him know what the NN-th printed letter will be without waiting for it to be printed?

Input

The first line of the input gives the number of test cases, TT. TT test cases follow.

Each test case consists of a single line with an integer NN.

Output

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 1) and yy is the NN-th character printed by Cody-Jamal's program.

Constraints

  • 1≤T≤1001 \le T \le 100.

Hint

The first 35 letters printed by Cody-Jamal's program are ABCDEFGHIJKLMNOPQRSTUVWXYZAABBCCDDE.... Therefore, the 5th printed character is E and the 31st is C.

Examples1

  1. Example 1

    Input
    2
    5
    31
    
    Expected output
    Case #1: E
    Case #2: C