#处理输入
s=input().split(' ')
n=int(s[0])
words=s[1:n+1]
x=s[n+1]
k=int(s[-1])
#别人的聪明办法
#使用sorted的对单词中的字母进行排序,降低了算法复杂度
a=[]#用a存储兄弟单词
for word in words:
if x!=word and sorted(x)==sorted(word):
a.append(word)
print(len(a),end='\n')
if len(a)>=k:
print(sorted(a)[k-1])
#我的笨办法:使用字典来记录每个字母在单词x中的数量,在判断words中字母出现的数量和字典一不一样:
dic1={i:x.count(i) for i in set(x)}
a=[]#用a存储兄弟单词
for word in words:
if set(x)==set(word) and x!=word:
f=1
for j in dic1:
if dic1[j]!=word.count(j):
f=0
if f==1:
a.append(word)
print(len(a),end='\n')
if len(a)>=k:
print(sorted(a)[k-1])