s = str(eval(input()))

k = int(eval(input()))



check = []

a = min(len(s),k)

for i in range(len(s)):

    for j in range(a):

        if i <= i+j <=len(s)+1:

            check.append(s[i:i+j+1])

            

print((sorted(set(check))[k-1]))
s = str(eval(input()))

k = int(eval(input()))



check = []

for i in range(len(s)):

    for j in range(k):

        check.append(s[i:i+j+1])

        

print((sorted(list(set(check)))[k-1]))
s = str(eval(input()))
k = int(eval(input()))
check = []
a = min(len(s), k)
for i in range(len(s)):
    for j in range(a):
        if i <= i + j <= len(s) + 1:
            check.append(s[i : i + j + 1])
print((sorted(set(check))[k - 1]))

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

-a = min(len(s), k) -    for j in range(a): -        if i <= i + j <= len(s) + 1: -            check.append(s[i : i + j + 1]) -print((sorted(set(check))[k - 1])) +    for j in range(k): +        check.append(s[i : i + j + 1]) +print((sorted(list(set(check)))[k - 1]))