408491: GYM103150 E o

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. otime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given two strings $$$s$$$ and $$$t$$$. An operation consists of the following:

  • pick two characters in different positions, replace one of them with o, and replace the other one with any lowercase English letter.
Can you turn $$$s$$$ into $$$t$$$ using several (one or more) operations?Input

The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases.

The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 2000$$$) — the length of $$$s$$$ and $$$t$$$.

The next two lines contain the strings $$$s$$$ and $$$t$$$ of length $$$n$$$, consisting of lowercase English letters. Additional constraint on the input: $$$s \neq t$$$.

Output

For each test case, output YES if it is possible to turn $$$s$$$ into $$$t$$$ using these operations. Otherwise, output NO. You can print each letter of YES and NO in any case (upper or lower).

ExampleInput
2
3
qrs
orz
4
ezpc
icpc
Output
YES
NO
Note

In the first test case, we can pick the characters q and s in qrs, turn q into o, and turn s into z. The resulting string is orz.

In the second test case, it can be shown that it is impossible to turn $$$s$$$ into $$$t$$$.

加入题单

上一题 下一题 算法标签: