S = eval(input())

k = int(eval(input()))

abc = []

for i in range(len(S)):

    for j in range(1, k+1):

        if i+j <= len(S):

            s = S[i:i+j]

            if not s in abc:

                abc.append(S[i:i+j])

    

abc = sorted(abc)

print((abc[k-1]))

S = eval(input())

k = int(eval(input()))

ss = []

for i in range(len(S)):

    for j in range(i+1, min(i+k+1, len(S)+1)):

        ss.append(S[i:j])



ss = sorted(list(set(ss)))

print((ss[k-1]))
S = eval(input())
k = int(eval(input()))
abc = []
for i in range(len(S)):
    for j in range(1, k + 1):
        if i + j <= len(S):
            s = S[i : i + j]
            if not s in abc:
                abc.append(S[i : i + j])
abc = sorted(abc)
print((abc[k - 1]))

S = eval(input())
k = int(eval(input()))
ss = []
for i in range(len(S)):
    for j in range(i + 1, min(i + k + 1, len(S) + 1)):
        ss.append(S[i:j])
ss = sorted(list(set(ss)))
print((ss[k - 1]))

-abc = [] +ss = [] -    for j in range(1, k + 1): -        if i + j <= len(S): -            s = S[i : i + j] -            if not s in abc: -                abc.append(S[i : i + j]) -abc = sorted(abc) -print((abc[k - 1])) +    for j in range(i + 1, min(i + k + 1, len(S) + 1)): +        ss.append(S[i:j]) +ss = sorted(list(set(ss))) +print((ss[k - 1]))