S = eval(input())

N = len(S)

K = int(eval(input()))



A = set()

for i in range(N):

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

        if j > i + K:

            break

        A.add(S[i:j])



A = list(A)

A.sort()

print((A[K - 1]))

S = eval(input())

K = int(eval(input()))



A = set()

for leng in range(1, K + 1):

    for i in range(len(S) - leng + 1):

        A.add(S[i: i + leng])

A = list(A)

A.sort()



print((A[K - 1]))

S = eval(input())
N = len(S)
K = int(eval(input()))
A = set()
for i in range(N):
    for j in range(i + 1, N + 1):
        if j > i + K:
            break
        A.add(S[i:j])
A = list(A)
A.sort()
print((A[K - 1]))

S = eval(input())
K = int(eval(input()))
A = set()
for leng in range(1, K + 1):
    for i in range(len(S) - leng + 1):
        A.add(S[i : i + leng])
A = list(A)
A.sort()
print((A[K - 1]))

-N = len(S) -for i in range(N): -    for j in range(i + 1, N + 1): -        if j > i + K: -            break -        A.add(S[i:j]) +for leng in range(1, K + 1): +    for i in range(len(S) - leng + 1): +        A.add(S[i : i + leng])