s = eval(input())

k = int(eval(input()))



t = set()



for i in range(len(s)):

  tt = ""

  for j in range(i, min(i+5, len(s))):

    tt+=s[j]

    t.add(tt)



print((sorted(t)[k-1]))
s = eval(input())

k = int(eval(input()))

d = set()

for i in range(1, 6):

  for j in range(len(s)):

    d.add(s[j:j+i])

print((sorted(d)[k-1]))
s = eval(input())
k = int(eval(input()))
t = set()
for i in range(len(s)):
    tt = ""
    for j in range(i, min(i + 5, len(s))):
        tt += s[j]
        t.add(tt)
print((sorted(t)[k - 1]))

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

-t = set() -for i in range(len(s)): -    tt = "" -    for j in range(i, min(i + 5, len(s))): -        tt += s[j] -        t.add(tt) -print((sorted(t)[k - 1])) +d = set() +for i in range(1, 6): +    for j in range(len(s)): +        d.add(s[j : j + i]) +print((sorted(d)[k - 1]))