Codeforces Round 921 (Div. 2)
C
Did We Get Everything Covered?
Codeforces
未评级
原题
← BD →
翻译中…

You are given two integers $n$ and $k$ along with a string $s$.

翻译中…

Your task is to check whether all possible strings of length $n$ that can be formed using the first $k$ lowercase English alphabets occur as a subsequence of $s$. If the answer is NO, you also need to print a string of length $n$ that can be formed using the first $k$ lowercase English alphabets which does not occur as a subsequence of $s$.

翻译中…

If there are multiple answers, you may print any of them.

翻译中…

Note: A string $a$ is called a subsequence of another string $b$ if $a$ can be obtained by deleting some (possibly zero) characters from $b$ without changing the order of the remaining characters.

翻译中…

Input

翻译中…

The first line of input contains a single integer $t \, (1 \le t \le 10^5)$, the number of test cases.

翻译中…

The first line of each test case contains $3$ integers $n \, (1 \le n \le 26), \: k \, (1 \le k \le 26), \: m \, (1 \le m \le 1000)$, where $n$ and $k$ are the same as described in the input and $m$ is the length of the string $s$.

翻译中…

The second line of each test case contains a single string $s$ of length $m$, comprising only of the first $k$ lowercase English alphabets.

翻译中…

It is guaranteed that the sum of $m$ and the sum of $n$ over all test cases does not exceed $10^6$.

翻译中…

Output

翻译中…

For each test case, print YES if all possible strings of length $n$ that can be formed using the first $k$ lowercase English alphabets occur as a subsequence of $s$, else print NO.

翻译中…

If your answer is NO, print a string of length $n$ that can be formed using the first $k$ lowercase English alphabets which does not occur as a subsequence of $s$ in the next line.

翻译中…

You may print each letter of YES or NO in any case (for example, YES, yES, YeS will all be recognized as a positive answer).

翻译中…

Note

翻译中…

For the first test case, all possible strings (aa, ab, ba, bb) of length $2$ that can be formed using the first $2$ English alphabets occur as a subsequence of abba.

翻译中…

For the second test case, the string aa is not a subsequence of abb.

翻译中…

样例

Input #1
3
2 2 4
abba
2 2 3
abb
3 3 10
aabbccabab
Output #1
YES
NO
aa
NO
ccc
InputCopy OutputCopy
题目信息
题号
1925C
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。