s = str(eval(input()))

K = int(eval(input()))



T = []

#for i in range(1,min(K,len(s))):

#  T.append(s[:i+1])

#print(T)



for i in range(len(s)): #i文字目スタート

  for j in range(i+1,min(len(s)+1,i+K+1)): #j文字

    temp = s[i:j]

    if temp in T:

      continue

    if len(T) < K:

      T.append(temp)

      T.sort()

    else:

      Flag = False

      for t in range(K):

        if temp < T[t]:

          #print(temp,T[t],T)

          T.insert(t,temp)

          Flag = True

          break

      if Flag:

        T.pop()

print((T[K-1]))

    
S = str(eval(input()))

K = int(eval(input()))

N = len(S)

L = set([])



for i in range(N):

  temp = S[i]

  L.add(temp)

  for j in range(1,min(N-i,K)):

    temp += S[i+j]

    L.add(temp)

#print(L)

L = list(L)

L.sort()

print((L[K-1]))
s = str(eval(input()))
K = int(eval(input()))
T = []
# for i in range(1,min(K,len(s))):
#  T.append(s[:i+1])
# print(T)
for i in range(len(s)):  # i文字目スタート
    for j in range(i + 1, min(len(s) + 1, i + K + 1)):  # j文字
        temp = s[i:j]
        if temp in T:
            continue
        if len(T) < K:
            T.append(temp)
            T.sort()
        else:
            Flag = False
            for t in range(K):
                if temp < T[t]:
                    # print(temp,T[t],T)
                    T.insert(t, temp)
                    Flag = True
                    break
            if Flag:
                T.pop()
print((T[K - 1]))

S = str(eval(input()))
K = int(eval(input()))
N = len(S)
L = set([])
for i in range(N):
    temp = S[i]
    L.add(temp)
    for j in range(1, min(N - i, K)):
        temp += S[i + j]
        L.add(temp)
# print(L)
L = list(L)
L.sort()
print((L[K - 1]))

-s = str(eval(input())) +S = str(eval(input())) -T = [] -# for i in range(1,min(K,len(s))): -#  T.append(s[:i+1]) -# print(T) -for i in range(len(s)):  # i文字目スタート -    for j in range(i + 1, min(len(s) + 1, i + K + 1)):  # j文字 -        temp = s[i:j] -        if temp in T: -            continue -        if len(T) < K: -            T.append(temp) -            T.sort() -        else: -            Flag = False -            for t in range(K): -                if temp < T[t]: -                    # print(temp,T[t],T) -                    T.insert(t, temp) -                    Flag = True -                    break -            if Flag: -                T.pop() -print((T[K - 1])) +N = len(S) +L = set([]) +for i in range(N): +    temp = S[i] +    L.add(temp) +    for j in range(1, min(N - i, K)): +        temp += S[i + j] +        L.add(temp) +# print(L) +L = list(L) +L.sort() +print((L[K - 1]))