import sys def printfl(*args, **kwargs): print(*args, **kwargs) sys.stdout.flush() T = int(input()) for t in range(1, T+1): N = int(input()) n_min = 0 # allowed n_max = N # not allowed while n_max - n_min > 1: n_mid = (n_min+n_max)//2 if 26*n_mid*(n_mid+1)//2 < N: n_min = n_mid else: n_max = n_mid N -= 26*n_min*(n_min+1)//2 ans = chr(ord('A') + (N-1)//n_max) print(f"Case #{t}: {ans}")