s = eval(input())

K = int(eval(input()))



from heapq import heappush, heappop



Q = set()

u = set()

N = len(s)

for i in range(N):

    for j in range(i+1, i+K+1):

        ss = s[i:j]

        if ss in u:

            continue

        u.add(ss)

        Q.add(ss)

        if len(Q) > K:

            Q.remove(max(Q))

l = sorted(Q)

print((l[K-1]))

s = eval(input())

K = int(eval(input()))

Q = set()

L = len(s)

for i in range(L):

    for j in range(K):

        if i+j+1 <= L:

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

print((sorted(Q)[K-1]))
s = eval(input())
K = int(eval(input()))
from heapq import heappush, heappop

Q = set()
u = set()
N = len(s)
for i in range(N):
    for j in range(i + 1, i + K + 1):
        ss = s[i:j]
        if ss in u:
            continue
        u.add(ss)
        Q.add(ss)
        if len(Q) > K:
            Q.remove(max(Q))
l = sorted(Q)
print((l[K - 1]))

s = eval(input())
K = int(eval(input()))
Q = set()
L = len(s)
for i in range(L):
    for j in range(K):
        if i + j + 1 <= L:
            Q.add(s[i : i + j + 1])
print((sorted(Q)[K - 1]))

-from heapq import heappush, heappop - -u = set() -N = len(s) -for i in range(N): -    for j in range(i + 1, i + K + 1): -        ss = s[i:j] -        if ss in u: -            continue -        u.add(ss) -        Q.add(ss) -        if len(Q) > K: -            Q.remove(max(Q)) -l = sorted(Q) -print((l[K - 1])) +L = len(s) +for i in range(L): +    for j in range(K): +        if i + j + 1 <= L: +            Q.add(s[i : i + j + 1]) +print((sorted(Q)[K - 1]))