s = str(eval(input()))

K = int(eval(input()))

stack = []

for i in range(len(s)):

    for j in range(i+1, min(i+K, len(s))+1):

        sub = s[i:j]

        if sub not in stack:

            stack.append(sub)

stack.sort()

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

K = int(eval(input()))

stack = []

for i in range(len(s)):

    for j in range(i+1, min(i+K, len(s))+1):

        sub = s[i:j]

        stack.append(sub)

stack = sorted(set(stack))

print((stack[K-1]))
s = str(eval(input()))
K = int(eval(input()))
stack = []
for i in range(len(s)):
    for j in range(i + 1, min(i + K, len(s)) + 1):
        sub = s[i:j]
        if sub not in stack:
            stack.append(sub)
stack.sort()
print((stack[K - 1]))

s = str(eval(input()))
K = int(eval(input()))
stack = []
for i in range(len(s)):
    for j in range(i + 1, min(i + K, len(s)) + 1):
        sub = s[i:j]
        stack.append(sub)
stack = sorted(set(stack))
print((stack[K - 1]))

-        if sub not in stack: -            stack.append(sub) -stack.sort() +        stack.append(sub) +stack = sorted(set(stack))