S = eval(input())

K = int(eval(input()))



substring_set = set()

for i in range(len(S)):

    substring = []

    for j in range(min([K, len(S)-i])):

        substring.append(S[i+j])

        substring_set.add(''.join(substring))



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

S = eval(input())

K = int(eval(input()))

len_s = len(S)



substring_set = set()

for i in range(len_s):

    for j in range(min([K, len_s-i])):

        substring_set.add(S[i:i+j+1])



sorted_list = sorted(list(substring_set))

print((sorted_list[K-1]))

S = eval(input())
K = int(eval(input()))
substring_set = set()
for i in range(len(S)):
    substring = []
    for j in range(min([K, len(S) - i])):
        substring.append(S[i + j])
        substring_set.add("".join(substring))
print((sorted(list(substring_set))[K - 1]))

S = eval(input())
K = int(eval(input()))
len_s = len(S)
substring_set = set()
for i in range(len_s):
    for j in range(min([K, len_s - i])):
        substring_set.add(S[i : i + j + 1])
sorted_list = sorted(list(substring_set))
print((sorted_list[K - 1]))

+len_s = len(S) -for i in range(len(S)): -    substring = [] -    for j in range(min([K, len(S) - i])): -        substring.append(S[i + j]) -        substring_set.add("".join(substring)) -print((sorted(list(substring_set))[K - 1])) +for i in range(len_s): +    for j in range(min([K, len_s - i])): +        substring_set.add(S[i : i + j + 1]) +sorted_list = sorted(list(substring_set)) +print((sorted_list[K - 1]))