S = eval(input())

K = int(eval(input()))



A = []

for i in range(len(S)):  

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

        if S[i:j] != "":

            A.append(S[i:j])



A = sorted(set(A))

        

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

K = int(eval(input()))

A = []

for i in range(len(S)):

    for j in range(1,6):

        a = S[i:i+j]

        A.append(a)   

        #print(A)



A = set(A)

A = sorted(set(A))

print((A[K-1]))
S = eval(input())
K = int(eval(input()))
A = []
for i in range(len(S)):
    for j in range(1, i + 6):
        if S[i:j] != "":
            A.append(S[i:j])
A = sorted(set(A))
print((A[K - 1]))

S = eval(input())
K = int(eval(input()))
A = []
for i in range(len(S)):
    for j in range(1, 6):
        a = S[i : i + j]
        A.append(a)
        # print(A)
A = set(A)
A = sorted(set(A))
print((A[K - 1]))

-    for j in range(1, i + 6): -        if S[i:j] != "": -            A.append(S[i:j]) +    for j in range(1, 6): +        a = S[i : i + j] +        A.append(a) +        # print(A) +A = set(A)