s = eval(input())

k = int(eval(input()))

x = []

n = len(s)

for i in range(k):

    for j in range(n-i):

        t = s[j:j+i+1]

        if not t in x:

            x.append(t)

x.sort()

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

k = int(eval(input()))

x = set()

n = len(s)

for i in range(k):

    for j in range(n-i):

        t = s[j:j+i+1]

        if not t in x:

            x.add(t)

x=list(x)

x.sort()

print((x[k-1]))
s = eval(input())
k = int(eval(input()))
x = []
n = len(s)
for i in range(k):
    for j in range(n - i):
        t = s[j : j + i + 1]
        if not t in x:
            x.append(t)
x.sort()
print((x[k - 1]))

s = eval(input())
k = int(eval(input()))
x = set()
n = len(s)
for i in range(k):
    for j in range(n - i):
        t = s[j : j + i + 1]
        if not t in x:
            x.add(t)
x = list(x)
x.sort()
print((x[k - 1]))

-x = [] +x = set() -            x.append(t) +            x.add(t) +x = list(x)