### constant

KMAP = {
  '2' => /[a-c]/, '3' => /[d-f]/, '4' => /[g-i]/, '5' => /[j-l]/,
  '6' => /[m-o]/, '7' => /[p-s]/, '8' => /[t-v]/, '9' => /[w-z]/
}

### subroutines

def match?(word, seq, k)
  for i in (0...word.length)
    return false if word[i] !~ KMAP[seq[k + i]]
  end
  true
end

def check_rec(dic, seq, k = 0, words = [])
  if k >= seq.length
    $ans << words.join(' ') + '.' if ! words.empty?
    return
  end

  for word in dic
    if match?(word, seq, k)
      check_rec(dic, seq, k + word.length, words + [word])
    end
  end
end

### main

loop do
  n = gets.to_i
  break if n == 0

  dic = n.times.map{gets.strip}
  seq = gets.strip.split('')
  #p dic
  #p seq

  $ans = []
  check_rec(dic, seq)

  puts $ans.sort
  puts '--'
end