CF1999D.Slavic's Exam

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Slavic's Exam

Slavic has a very tough exam and needs your help in order to pass it. Here is the question he is struggling with:

There exists a string ss, which consists of lowercase English letters and possibly zero or more "?".

Slavic is asked to change each "?" to a lowercase English letter such that string tt becomes a subsequence (not necessarily continuous) of the string ss.

Output any such string, or say that it is impossible in case no string that respects the conditions exists.

Input

The first line contains a single integer TT (1T1041 \leq T \leq 10^4) — the number of test cases.

The first line of each test case contains a single string ss (1s21051 \leq |s| \leq 2 \cdot 10^5, and ss consists only of lowercase English letters and "?"-s)  – the original string you have.

The second line of each test case contains a single string tt (1ts1 \leq |t| \leq |s|, and tt consists only of lowercase English letters)  – the string that should be a subsequence of string ss.

The sum of s|s| over all test cases doesn't exceed 21052 \cdot 10^5, where x|x| denotes the length of the string xx.

Output

For each test case, if no such string exists as described in the statement, output "NO" (without quotes).

Otherwise, output "YES" (without quotes). Then, output one line — the string that respects all conditions.

You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).

If multiple answers are possible, you can output any of them.

Samples

5
?????
xbx
ab??e
abcde
ayy?x
a
ab??e
dac
paiu
mom
YES
xabax
YES
abcde
YES
ayyyx
NO
NO

在线编程 IDE

建议全屏模式获得最佳体验