s=eval(input())

k=int(eval(input()))

#s=list(input())



#t=[]

#for kk in range(k):

#    t.append(s)



t=["zzzzz"]*k



for i in range(len(s)):

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

        sij=s[i:j+1]

        for kk in range(k):

            if t[kk]==sij:

                break

        if t[kk]>sij:

            t[kk]=sij

            t.sort()

        

print((t[k-1]))  

#print(t) 

     
s=eval(input())

k=int(eval(input()))



sb=set()

for i in range(len(s)):

    for ii in range(i,i+k):

        if ii<len(s):

#            print(s[i:ii+1])            

            sb.add(s[i:ii+1])

sb2=list(sb)

sb2.sort()

print((sb2[k-1]))

s = eval(input())
k = int(eval(input()))
# s=list(input())
# t=[]
# for kk in range(k):
#    t.append(s)
t = ["zzzzz"] * k
for i in range(len(s)):
    for j in range(i, min(len(s), i + k)):
        sij = s[i : j + 1]
        for kk in range(k):
            if t[kk] == sij:
                break
        if t[kk] > sij:
            t[kk] = sij
            t.sort()
print((t[k - 1]))
# print(t)

s = eval(input())
k = int(eval(input()))
sb = set()
for i in range(len(s)):
    for ii in range(i, i + k):
        if ii < len(s):
            #            print(s[i:ii+1])
            sb.add(s[i : ii + 1])
sb2 = list(sb)
sb2.sort()
print((sb2[k - 1]))

-# s=list(input()) -# t=[] -# for kk in range(k): -#    t.append(s) -t = ["zzzzz"] * k +sb = set() -    for j in range(i, min(len(s), i + k)): -        sij = s[i : j + 1] -        for kk in range(k): -            if t[kk] == sij: -                break -        if t[kk] > sij: -            t[kk] = sij -            t.sort() -print((t[k - 1])) -# print(t) +    for ii in range(i, i + k): +        if ii < len(s): +            #            print(s[i:ii+1]) +            sb.add(s[i : ii + 1]) +sb2 = list(sb) +sb2.sort() +print((sb2[k - 1]))