s = eval(input())

k = int(eval(input()))

lst = []

m = min(5,len(s))

while True:

    if m<=0:

        break

    for i in range(len(s)-m+1):

        q = s[i:i+m]

        if not q in lst:

            lst.append(q)

    m -= 1



lst.sort()

print((lst[k-1]))
s = list(eval(input()))

k = int(eval(input()))

candidate = []

for i in range(len(s)):

    for j in range(k+1):

        candidate.append(s[i:i+j])

for i in range(len(candidate)):

    candidate[i] = "".join(candidate[i])

candidate = list(set(candidate))



candidate.sort()

print((candidate[k]))

s = eval(input())
k = int(eval(input()))
lst = []
m = min(5, len(s))
while True:
    if m <= 0:
        break
    for i in range(len(s) - m + 1):
        q = s[i : i + m]
        if not q in lst:
            lst.append(q)
    m -= 1
lst.sort()
print((lst[k - 1]))

s = list(eval(input()))
k = int(eval(input()))
candidate = []
for i in range(len(s)):
    for j in range(k + 1):
        candidate.append(s[i : i + j])
for i in range(len(candidate)):
    candidate[i] = "".join(candidate[i])
candidate = list(set(candidate))
candidate.sort()
print((candidate[k]))

-s = eval(input()) +s = list(eval(input())) -lst = [] -m = min(5, len(s)) -while True: -    if m <= 0: -        break -    for i in range(len(s) - m + 1): -        q = s[i : i + m] -        if not q in lst: -            lst.append(q) -    m -= 1 -lst.sort() -print((lst[k - 1])) +candidate = [] +for i in range(len(s)): +    for j in range(k + 1): +        candidate.append(s[i : i + j]) +for i in range(len(candidate)): +    candidate[i] = "".join(candidate[i]) +candidate = list(set(candidate)) +candidate.sort() +print((candidate[k]))