# Greedy
class Solution(object):
def getSmallestString(self, n, k):
"""
:type n: int
:type k: int
:rtype: str
"""
ans = ""
for i in range(n):
t = k - (n - 1 - i) * 26
if t <= 0:
ans += "a"
k -= 1
else:
ans += chr(ord('a') + t - 1)
k -= t
return ans