Codeforces Round 599 (Div. 2)
B1
Character Swap (Easy Version)
Codeforces
1000
原题
← AB2 →
翻译中…

This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.

翻译中…

After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.

翻译中…

Ujan has two distinct strings $s$ and $t$ of length $n$ consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation exactly once: he takes two positions $i$ and $j$ ($1 \le i,j \le n$, the values $i$ and $j$ can be equal or different), and swaps the characters $s_i$ and $t_j$. Can he succeed?

翻译中…

Note that he has to perform this operation exactly once. He has to perform this operation.

翻译中…

Input

翻译中…

The first line contains a single integer $k$ ($1 \leq k \leq 10$), the number of test cases.

翻译中…

For each of the test cases, the first line contains a single integer $n$ ($2 \leq n \leq 10^4$), the length of the strings $s$ and $t$.

翻译中…

Each of the next two lines contains the strings $s$ and $t$, each having length exactly $n$. The strings consist only of lowercase English letters. It is guaranteed that strings are different.

翻译中…

Output

翻译中…

For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise.

翻译中…

You can print each letter in any case (upper or lower).

翻译中…

Note

翻译中…

In the first test case, Ujan can swap characters $s_1$ and $t_4$, obtaining the word "house".

翻译中…

In the second test case, it is not possible to make the strings equal using exactly one swap of $s_i$ and $t_j$.

翻译中…

样例

Input #1
4
5
souse
houhe
3
cat
dog
2
aa
az
3
abc
bca
Output #1
Yes
No
No
No
InputCopy OutputCopy
题目信息
题号
1243B1
时间限制
1 s
内存限制
256 MB
标签
字符串

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