s=eval(input())

K=int(eval(input()))



sub_list=[]

i,j=0,1

while True:

    if(i+j>=len(s) and i==len(s)):

        break

    else:

        sub_list.append(s[i:i+j])

        if(j<=K):

            j+=1

        else:

            i+=1

            j=1

set_list=set(sub_list)



dict_list=list(set_list)

dict_list.sort(key=str)



print((dict_list[K-1]))
s=eval(input())

K=int(eval(input()))



sub_list=[]



for i in range(len(s)):

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

        if(i+j<=len(s)):

            sub_list.append(s[i:i+j])



sub_set=set(sub_list)

sub_dict=sorted(sub_set,key=str)



print((sub_dict[K-1]))
s = eval(input())
K = int(eval(input()))
sub_list = []
i, j = 0, 1
while True:
    if i + j >= len(s) and i == len(s):
        break
    else:
        sub_list.append(s[i : i + j])
        if j <= K:
            j += 1
        else:
            i += 1
            j = 1
set_list = set(sub_list)
dict_list = list(set_list)
dict_list.sort(key=str)
print((dict_list[K - 1]))

s = eval(input())
K = int(eval(input()))
sub_list = []
for i in range(len(s)):
    for j in range(1, K + 1):
        if i + j <= len(s):
            sub_list.append(s[i : i + j])
sub_set = set(sub_list)
sub_dict = sorted(sub_set, key=str)
print((sub_dict[K - 1]))

-i, j = 0, 1 -while True: -    if i + j >= len(s) and i == len(s): -        break -    else: -        sub_list.append(s[i : i + j]) -        if j <= K: -            j += 1 -        else: -            i += 1 -            j = 1 -set_list = set(sub_list) -dict_list = list(set_list) -dict_list.sort(key=str) -print((dict_list[K - 1])) +for i in range(len(s)): +    for j in range(1, K + 1): +        if i + j <= len(s): +            sub_list.append(s[i : i + j]) +sub_set = set(sub_list) +sub_dict = sorted(sub_set, key=str) +print((sub_dict[K - 1]))