s = eval(input())

k = int(eval(input()))



a = list(s)

a = [ord(i) for i in a]

b = sorted(set(a))

c = []

INF = 97+26

for m in b:

    a1 = [i for i in range(len(s)) if a[i] == m]



    for i in a1:

        j = 0

        for j in range(k):

            if s[i:i+j+1] not in c:

                c.append(s[i:i+j+1])

                c.sort()

            if len(c) > 5:

                del c[-1]

            j += 1

            if i + j >= len(s):

                break

    if len(c) >= k:

        break



print((c[k-1]))

s = eval(input())

k = int(eval(input()))



a = list(s)

a = [ord(i) for i in a]

b = sorted(set(a))

c = []

INF = 97+26

for m in b:

    a1 = [i for i in range(len(s)) if a[i] == m]



    for i in a1:

        j = 0

        for j in range(k):

            if i + j >= len(s):

                break

            if s[i:i+j+1] not in c:

                c.append(s[i:i+j+1])

                c.sort()

            if len(c) > 5:

                del c[-1]



    if len(c) >= k:

        break



print((c[k-1]))

s = eval(input())
k = int(eval(input()))
a = list(s)
a = [ord(i) for i in a]
b = sorted(set(a))
c = []
INF = 97 + 26
for m in b:
    a1 = [i for i in range(len(s)) if a[i] == m]
    for i in a1:
        j = 0
        for j in range(k):
            if s[i : i + j + 1] not in c:
                c.append(s[i : i + j + 1])
                c.sort()
            if len(c) > 5:
                del c[-1]
            j += 1
            if i + j >= len(s):
                break
    if len(c) >= k:
        break
print((c[k - 1]))

s = eval(input())
k = int(eval(input()))
a = list(s)
a = [ord(i) for i in a]
b = sorted(set(a))
c = []
INF = 97 + 26
for m in b:
    a1 = [i for i in range(len(s)) if a[i] == m]
    for i in a1:
        j = 0
        for j in range(k):
            if i + j >= len(s):
                break
            if s[i : i + j + 1] not in c:
                c.append(s[i : i + j + 1])
                c.sort()
            if len(c) > 5:
                del c[-1]
    if len(c) >= k:
        break
print((c[k - 1]))

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