s = eval(input())

K = int(eval(input()))

head = [h for h in s]



head = set(head)

head = list(head)

head.sort()



cnt = 0

ans = []

idx = 0

while cnt < K:

    for i in range(len(s)):

        if s[i] == head[idx]:

            for k in range(i+1, min(len(s)+1, i+6)):

                ans.append(s[i:k])

        ans = set(ans)

        ans = list(ans)

        cnt = len(ans)

    idx += 1

ans = set(ans)

ans = list(ans)

ans.sort()

print((ans[K-1]))
s = eval(input())

ans = set()

k = int(eval(input()))

for i in range(len(s)):

    for j in range(1, k+1):

        ans.add(s[i:i+j])

print((sorted(list(ans))[k-1]))
s = eval(input())
K = int(eval(input()))
head = [h for h in s]
head = set(head)
head = list(head)
head.sort()
cnt = 0
ans = []
idx = 0
while cnt < K:
    for i in range(len(s)):
        if s[i] == head[idx]:
            for k in range(i + 1, min(len(s) + 1, i + 6)):
                ans.append(s[i:k])
        ans = set(ans)
        ans = list(ans)
        cnt = len(ans)
    idx += 1
ans = set(ans)
ans = list(ans)
ans.sort()
print((ans[K - 1]))

s = eval(input())
ans = set()
k = int(eval(input()))
for i in range(len(s)):
    for j in range(1, k + 1):
        ans.add(s[i : i + j])
print((sorted(list(ans))[k - 1]))

-K = int(eval(input())) -head = [h for h in s] -head = set(head) -head = list(head) -head.sort() -cnt = 0 -ans = [] -idx = 0 -while cnt < K: -    for i in range(len(s)): -        if s[i] == head[idx]: -            for k in range(i + 1, min(len(s) + 1, i + 6)): -                ans.append(s[i:k]) -        ans = set(ans) -        ans = list(ans) -        cnt = len(ans) -    idx += 1 -ans = set(ans) -ans = list(ans) -ans.sort() -print((ans[K - 1])) +ans = set() +k = int(eval(input())) +for i in range(len(s)): +    for j in range(1, k + 1): +        ans.add(s[i : i + j]) +print((sorted(list(ans))[k - 1]))