s = eval(input())

N = int(eval(input()))

len_s = len(s)



sub_set = set()



for start in range(len_s):

    k = 1

    while k <= min(len_s-start, N):

        sub_set.add(s[start:start+k])

        k += 1

        



sub_list = list(sub_set)

sub_list.sort()



print((sub_list[N-1]))
s = eval(input())

K = int(eval(input()))



len_s = len(s)



sub_set = set()

for k in range(1,6):

    for i in range(len_s-k+1):

        sub_set.add(s[i:i+k])

        

sub_list = list(sub_set)

sub_list.sort()

print((sub_list[K-1]))

        

        
s = eval(input())
N = int(eval(input()))
len_s = len(s)
sub_set = set()
for start in range(len_s):
    k = 1
    while k <= min(len_s - start, N):
        sub_set.add(s[start : start + k])
        k += 1
sub_list = list(sub_set)
sub_list.sort()
print((sub_list[N - 1]))

s = eval(input())
K = int(eval(input()))
len_s = len(s)
sub_set = set()
for k in range(1, 6):
    for i in range(len_s - k + 1):
        sub_set.add(s[i : i + k])
sub_list = list(sub_set)
sub_list.sort()
print((sub_list[K - 1]))

-N = int(eval(input())) +K = int(eval(input())) -for start in range(len_s): -    k = 1 -    while k <= min(len_s - start, N): -        sub_set.add(s[start : start + k]) -        k += 1 +for k in range(1, 6): +    for i in range(len_s - k + 1): +        sub_set.add(s[i : i + k]) -print((sub_list[N - 1])) +print((sub_list[K - 1]))