S = eval(input())

K = int(eval(input()))

a = list(set(S))

a.sort()



k = []

l = 0

while l < len(a):

    for i in range(len(S)):

        if S[i] == a[l]:

            for j in range(1,6):

                if i+j <= len(S):

                    k.append(S[i:i+j])

                else:

                    break

    l += 1



k = list(set(k))

k.sort()

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

K = int(eval(input()))

a = []

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

    for j in range(1,6):

        if i+j <= len(S):

            a.append(S[i:i+j])

        else:

            break

            

a = list(set(a))

a.sort()

print((a[K-1]))
S = eval(input())
K = int(eval(input()))
a = list(set(S))
a.sort()
k = []
l = 0
while l < len(a):
    for i in range(len(S)):
        if S[i] == a[l]:
            for j in range(1, 6):
                if i + j <= len(S):
                    k.append(S[i : i + j])
                else:
                    break
    l += 1
k = list(set(k))
k.sort()
print((k[K - 1]))

S = eval(input())
K = int(eval(input()))
a = []
for i in range(len(S) + 1):
    for j in range(1, 6):
        if i + j <= len(S):
            a.append(S[i : i + j])
        else:
            break
a = list(set(a))
a.sort()
print((a[K - 1]))

-a = list(set(S)) +a = [] +for i in range(len(S) + 1): +    for j in range(1, 6): +        if i + j <= len(S): +            a.append(S[i : i + j]) +        else: +            break +a = list(set(a)) -k = [] -l = 0 -while l < len(a): -    for i in range(len(S)): -        if S[i] == a[l]: -            for j in range(1, 6): -                if i + j <= len(S): -                    k.append(S[i : i + j]) -                else: -                    break -    l += 1 -k = list(set(k)) -k.sort() -print((k[K - 1])) +print((a[K - 1]))