s = eval(input())

k = int(eval(input()))

t = sorted(s)[min(k-1,len(s)-1)]

data = []

for i in range(len(s)):

    if s[i] <= t:

        data.append(s[i:])

data.sort()

if len(data) > k:

    data = data[:k]



ndata = []

for ss in data:

    for i in range(len(ss)):

        ndata.append(ss[:i+1])

ndata = list(set(ndata))

ndata.sort()

print((ndata[k-1]))

s = eval(input())

k = int(eval(input()))

data = []

for i in range(len(s)):

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

        data.append(s[i:min(i+j,len(s))])

data = list(set(data))

data.sort()

print((data[k-1]))
s = eval(input())
k = int(eval(input()))
t = sorted(s)[min(k - 1, len(s) - 1)]
data = []
for i in range(len(s)):
    if s[i] <= t:
        data.append(s[i:])
data.sort()
if len(data) > k:
    data = data[:k]
ndata = []
for ss in data:
    for i in range(len(ss)):
        ndata.append(ss[: i + 1])
ndata = list(set(ndata))
ndata.sort()
print((ndata[k - 1]))

s = eval(input())
k = int(eval(input()))
data = []
for i in range(len(s)):
    for j in range(1, k + 1):
        data.append(s[i : min(i + j, len(s))])
data = list(set(data))
data.sort()
print((data[k - 1]))

-t = sorted(s)[min(k - 1, len(s) - 1)] -    if s[i] <= t: -        data.append(s[i:]) +    for j in range(1, k + 1): +        data.append(s[i : min(i + j, len(s))]) +data = list(set(data)) -if len(data) > k: -    data = data[:k] -ndata = [] -for ss in data: -    for i in range(len(ss)): -        ndata.append(ss[: i + 1]) -ndata = list(set(ndata)) -ndata.sort() -print((ndata[k - 1])) +print((data[k - 1]))