s=eval(input())

k=int(eval(input()))

cnt=[]

for i in range(len(s)):

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

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

        if t not in cnt:

            cnt.append(t)

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

k=int(eval(input()))

c=[]

for i in range(len(s)):

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

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

        if t not in c:

            c.append(t)

print((sorted(c)[k-1]))
s = eval(input())
k = int(eval(input()))
cnt = []
for i in range(len(s)):
    for j in range(min(len(s) - i, k)):
        t = s[i : i + j + 1]
        if t not in cnt:
            cnt.append(t)
print((sorted(cnt)[k - 1]))

s = eval(input())
k = int(eval(input()))
c = []
for i in range(len(s)):
    for j in range(min(len(s) - i, k)):
        t = s[i : i + j + 1]
        if t not in c:
            c.append(t)
print((sorted(c)[k - 1]))

-cnt = [] +c = [] -        if t not in cnt: -            cnt.append(t) -print((sorted(cnt)[k - 1])) +        if t not in c: +            c.append(t) +print((sorted(c)[k - 1]))