import sys, math, itertools, functools, collections input = sys.stdin.readline def solve(testcase): def ans(x): return x * (x+1) // 2 * 26 n = int(input()) low, high = 0, 1000000 while low != high: mid = (low+high) >> 1 if ans(mid) >= n: high = mid else: low = mid+1 n -= ans(low-1) cur = (n-1) // low print('Case #'+str(testcase)+':', chr(65+cur)) for testcase in range(1, int(input())+1): solve(testcase)