def find_letter(n): # Calculate the repetition number and the count of letters printed up to that point repetition_num = (n - 1) // 26 letter_count = (1 + 26) * 26 // 2 * repetition_num # Calculate the index of the letter within its repetition index_within_repetition = n - letter_count - 1 # Calculate the letter based on its index within its repetition return chr(ord('A') + index_within_repetition) t = int(input()) for i in range(1, t+1): n = int(input()) result = find_letter(n) print(f"Case #{i}: {result}")