s = eval(input())

k = int(eval(input()))



ss = []

for i in range(len(s)):

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

        if s[i:j] not in ss:

            ss.append(s[i:j])

ss = sorted(ss)

print((ss[k-1]))


s = eval(input())

k = int(eval(input()))



ss = []

for i in range(len(s)):

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

        ss.append(s[i:j])

ss = sorted(list(set(ss)))

print((ss[k-1]))
s = eval(input())
k = int(eval(input()))
ss = []
for i in range(len(s)):
    for j in range(i + 1, i + k + 1):
        if s[i:j] not in ss:
            ss.append(s[i:j])
ss = sorted(ss)
print((ss[k - 1]))

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

-        if s[i:j] not in ss: -            ss.append(s[i:j]) -ss = sorted(ss) +        ss.append(s[i:j]) +ss = sorted(list(set(ss)))