s=eval(input())

K=int(eval(input()))



a=set()

for x in "abcdefghijklmnopqrstuvwxyz":

    for i in range(len(s)):

        if s[i]==x:

            for j in range(K):

                if i+j+1>len(s): break

                a.add(s[i:i+j+1])

         



    if len(a)>=K: break



a=sorted(list(a))

print((a[K-1]))

s=eval(input())

K=int(eval(input()))



a=set()

for x in sorted(list(set(s))):

    for i in range(len(s)):

        if s[i]==x:

            for j in range(K):

                if i+j+1>len(s): break

                a.add(s[i:i+j+1])

         



    if len(a)>=K: break



a=sorted(list(a))

print((a[K-1]))
s = eval(input())
K = int(eval(input()))
a = set()
for x in "abcdefghijklmnopqrstuvwxyz":
    for i in range(len(s)):
        if s[i] == x:
            for j in range(K):
                if i + j + 1 > len(s):
                    break
                a.add(s[i : i + j + 1])
    if len(a) >= K:
        break
a = sorted(list(a))
print((a[K - 1]))

s = eval(input())
K = int(eval(input()))
a = set()
for x in sorted(list(set(s))):
    for i in range(len(s)):
        if s[i] == x:
            for j in range(K):
                if i + j + 1 > len(s):
                    break
                a.add(s[i : i + j + 1])
    if len(a) >= K:
        break
a = sorted(list(a))
print((a[K - 1]))

-for x in "abcdefghijklmnopqrstuvwxyz": +for x in sorted(list(set(s))):