s=eval(input())

K=int(eval(input()))

a=[]



for i in range(K):

    for j in range(len(s)-i):

        a.append(s[j:j+i+1])

a.sort()

cnt=1

i=1

while cnt<K:

    if a[i]!=a[i-1]:

        cnt+=1

    i+=1

print((a[i-1]))

s=eval(input())

K=int(eval(input()))

a=set()



for i in range(K):

    for j in range(len(s)-i):

        a.add(s[j:j+i+1])

a=sorted(list(a))

print((a[K-1]))

s = eval(input())
K = int(eval(input()))
a = []
for i in range(K):
    for j in range(len(s) - i):
        a.append(s[j : j + i + 1])
a.sort()
cnt = 1
i = 1
while cnt < K:
    if a[i] != a[i - 1]:
        cnt += 1
    i += 1
print((a[i - 1]))

s = eval(input())
K = int(eval(input()))
a = set()
for i in range(K):
    for j in range(len(s) - i):
        a.add(s[j : j + i + 1])
a = sorted(list(a))
print((a[K - 1]))

-a = [] +a = set() -        a.append(s[j : j + i + 1]) -a.sort() -cnt = 1 -i = 1 -while cnt < K: -    if a[i] != a[i - 1]: -        cnt += 1 -    i += 1 -print((a[i - 1])) +        a.add(s[j : j + i + 1]) +a = sorted(list(a)) +print((a[K - 1]))