s = input().strip()

K = int(eval(input()))



S = set()

for i in range(len(s)):

    for w in range(1, K+1):

        S.add(s[i:i+w])



print((sorted(S)[K-1]))



s = input().strip()

K = int(eval(input()))



substr = set()



for i in range(len(s)):

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

        substr.add(s[i:i+j])



print((sorted(substr)[K-1]))

s = input().strip()
K = int(eval(input()))
S = set()
for i in range(len(s)):
    for w in range(1, K + 1):
        S.add(s[i : i + w])
print((sorted(S)[K - 1]))

s = input().strip()
K = int(eval(input()))
substr = set()
for i in range(len(s)):
    for j in range(1, K + 1):
        substr.add(s[i : i + j])
print((sorted(substr)[K - 1]))

-S = set() +substr = set() -    for w in range(1, K + 1): -        S.add(s[i : i + w]) -print((sorted(S)[K - 1])) +    for j in range(1, K + 1): +        substr.add(s[i : i + j]) +print((sorted(substr)[K - 1]))