P18078 [UKIEPC 2026] Austere Sign

Description

We are going to paint a sign but we can only afford stencils for $k$ letters. Update the text of the sign to use only $k$ unique letters without changing the lengths of any of the words, so that we can subtly fix the sign later. ![](https://cdn.luogu.com.cn/upload/image_hosting/orgw1tu8.webp) *Figure A.1: Illustration of Sample Input 1. You can do this!*

Input Format

- The first line of input contains the number of words, $n$ ($1 \le n \le 1000$), and the number of letters, $k$ ($1 \le k \le 26$). - The second line of input contains $n$ words. Each word consists of between $1$ and $20$ lowercase latin letters.

Output Format

Output a phrase using at most $k$ distinct letters, substituting as few from the original text as possible. If there are multiple possible answers, output any.