s = eval(input())

n = len(s)

K = int(eval(input()))

ans = set()



for i in range(n):

    end = min(n, i+10)

    for j in range(i+1, end+1):

        ans.add(s[i:j])



print((sorted(list(ans))[K-1]))

s = eval(input())

n = len(s)

K = int(eval(input()))

ans = set()



for i in range(n):

    end = min(n, i+K)

    for j in range(i+1, end+1):

        ans.add(s[i:j])



print((sorted(list(ans))[K-1]))

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

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

-    end = min(n, i + 10) +    end = min(n, i + K)