#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// 构造布尔函数,判断word是否是x的兄弟单词
bool isBrotherWord(string word,string x){
if (word == x){
return false;
}
sort(x.begin(),x.end());
sort(word.begin(),word.end());
if (x == word){
return true;
}
else return false;
}
int main() {
int n;
// 输入字典中单词的个数n
cin >> n;
string word;
// 输入n个单词作为字典单词
vector<string> vec;
while (n--) {
cin >> word;
vec.push_back(word);
}
// 寻找 x 的兄弟单词里,按字典序排列后的第 k 个单词是什么?
string x;
cin >> x;
int k;
cin >> k;
// res为存储x的兄弟单词的数组
vector<string> res;
for (auto i:vec){
if (isBrotherWord(i, x)){
res.push_back(i);
}
}
int m;
m = res.size();
cout << m << endl;
// 对res进行字典排序
sort(res.begin(),res.end());
if (m >= k){
cout << res[k-1] << endl;
}
return 0;
}