S = eval(input())

k = int(eval(input()))

A = set()

for l in range(k+1):

	for i in range(len(S)-l):

			A.add(S[i:i+l+1])

A = sorted(list(A))

print((A[k-1]))
S = eval(input())

l = len(S)

d = set()

K = int(eval(input()))

for i in range(5):

    for j in range(l-i):

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

D = sorted(list(d))

print((D[K-1]))
S = eval(input())
k = int(eval(input()))
A = set()
for l in range(k + 1):
    for i in range(len(S) - l):
        A.add(S[i : i + l + 1])
A = sorted(list(A))
print((A[k - 1]))

S = eval(input())
l = len(S)
d = set()
K = int(eval(input()))
for i in range(5):
    for j in range(l - i):
        d.add(S[j : j + i + 1])
D = sorted(list(d))
print((D[K - 1]))

-k = int(eval(input())) -A = set() -for l in range(k + 1): -    for i in range(len(S) - l): -        A.add(S[i : i + l + 1]) -A = sorted(list(A)) -print((A[k - 1])) +l = len(S) +d = set() +K = int(eval(input())) +for i in range(5): +    for j in range(l - i): +        d.add(S[j : j + i + 1]) +D = sorted(list(d)) +print((D[K - 1]))