#include <stdio.h>

/* 
比较是否是兄弟单词
成功返回:1
失败返回:0
*/
static int isBrother(char *base, char *str)
{
    int count[26] = {0};
    if(strlen(base) != strlen(str) || strcmp(base, str) == 0)
    {
        //长度不同 或 字符串相同都不是兄弟单词
        return 0;
    }
    else
    {
        for(int i = 0; i < strlen(base); i++)
        {
            count[base[i] - 'a']++;
            count[str[i] - 'a']--;
        }
        for(int i = 0; i < 26; i++)
        {
            if(count[i] != 0)    //非全0,说明字符数量不同
            {
                return 0;
            }
        }
        return 1;
    }
}

int main()
{
    int n = 0;
    if(scanf("%d", &n) != EOF)
    {
        char str[n][12];
        char sort[n][12];
        char base[12] = {0};
        int k = 0;
        memset(str, 0, n*12*sizeof(char));
        memset(sort, 0, n*12*sizeof(char));
        char need_str[n];
        memset(need_str, 0, n*sizeof(char));
        for(int i = 0; i < n; i++)
        {
            scanf("%s", str[i]);
            //printf("str[%d] = [%s]\n", i, str[i]);
        }
        scanf("%s", base);
        //printf("base = [%s]\n", base);
        scanf("%d", &k);
        //printf("k = [%d]\n", k);
        int index = 0;
        for(int i = 0; i < n; i++)
        {
            if(isBrother(base, str[i]))
            {
                strcpy(sort[index], str[i]);
                index++;
            }
        }
        printf("%d\n", index);

        char temp[12] = {0};
        int min = 0;
        for(int i = 0; i < index; i++)
        {
            min = i;
            for(int j = i+1; j < index; j++)
            {
                if(strcmp(sort[min], sort[j]) > 0)
                {
                    min = j;
                }
            }
            if(min != i)
            {
                strcpy(temp, sort[min]);
                strcpy(sort[min], sort[i]);
                strcpy(sort[i], temp);
            }
        }
        
        printf("%s\n", sort[k-1]);
    }
    return 0;
}