s = eval(input())

k = int(eval(input()))



dct = []

for i in range(len(s)):

    for j in range(k+1):

        word = s[i:i+j]

        if word not in dct:

            dct.append(word)

dct.sort()



print((dct[k]))
s = eval(input())

k = int(eval(input()))

lst = sorted(list(set(s)))

tank = []

for tg in lst:

    for i in range(len(s)):

        if s[i]==tg:

            for j in range(k):

                if i+j<=len(s) and (s[i:i+j+1] not in tank):

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

    if len(tank) >= k:

        break

tank.sort()

print((tank[k-1]))
s = eval(input())
k = int(eval(input()))
dct = []
for i in range(len(s)):
    for j in range(k + 1):
        word = s[i : i + j]
        if word not in dct:
            dct.append(word)
dct.sort()
print((dct[k]))

s = eval(input())
k = int(eval(input()))
lst = sorted(list(set(s)))
tank = []
for tg in lst:
    for i in range(len(s)):
        if s[i] == tg:
            for j in range(k):
                if i + j <= len(s) and (s[i : i + j + 1] not in tank):
                    tank.append(s[i : i + j + 1])
    if len(tank) >= k:
        break
tank.sort()
print((tank[k - 1]))

-dct = [] -for i in range(len(s)): -    for j in range(k + 1): -        word = s[i : i + j] -        if word not in dct: -            dct.append(word) -dct.sort() -print((dct[k])) +lst = sorted(list(set(s))) +tank = [] +for tg in lst: +    for i in range(len(s)): +        if s[i] == tg: +            for j in range(k): +                if i + j <= len(s) and (s[i : i + j + 1] not in tank): +                    tank.append(s[i : i + j + 1]) +    if len(tank) >= k: +        break +tank.sort() +print((tank[k - 1]))