B. P=NP
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Busy Beaver has a string $$$A$$$ made up of characters $$$\texttt{P}$$$ and $$$\texttt{N}$$$. He can perform two types of operations on $$$A$$$:

  • Pick a substring$$$^{\text{∗}}$$$ $$$\texttt{P}$$$ and replace it with $$$\texttt{NP}$$$.
  • Pick a substring $$$\texttt{NP}$$$ and replace it with $$$\texttt{P}$$$.

Busy Beaver has a target string $$$B$$$. Determine if he can turn $$$A$$$ into $$$B$$$ after some number of operations.

$$$^{\text{∗}}$$$A substring of length $$$k$$$ is a contiguous sequence of $$$k$$$ adjacent characters of a string.

Input

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

The only line of each test case contains the strings $$$A$$$ and $$$B$$$ ($$$1 \leq |A|, |B| \leq 10^5$$$), consisting of characters $$$\texttt{P}$$$ and $$$\texttt{N}$$$.

The sum of $$$|A|+|B|$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$.

Output

For each test case, output YES if Busy Beaver can turn $$$A$$$ into $$$B$$$ using the operations above, and NO otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Example
Input
7
P NP
PNPN NPPN
PP NP
NPN PPNP
PNPP PPNNNNNNNNNNNNNNNNNNP
PPNNPPNNPP NNPPNNPPNN
NPNNNNNPN PPPN
Output
YES
YES
NO
NO
YES
NO
NO
Note

In the first test case, we can perform one operation to turn $$$\texttt{P}$$$ into $$$\texttt{NP}$$$.

In the second test case, we can do two operations: $$$\texttt{P}\color{red}{\texttt{NP}}\texttt{N} \to \texttt{P}\color{red}{\texttt{P}}\texttt{N}$$$ and then $$$\color{red}{\texttt{P}}\texttt{PN} \to \color{red}{\texttt{NP}}\texttt{PN}$$$.

In the third test case, we can show that it is not possible to turn $$$\texttt{PP}$$$ into $$$\texttt{NP}$$$ using any number of operations.