## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Number Replacement Codeforces Solution

A. Number Replacement
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

An integer array ${a}_{1},{a}_{2},\dots ,{a}_{n}$ is being transformed into an array of lowercase English letters using the following prodecure:

While there is at least one number in the array:

• Choose any number $x$ from the array $a$, and any letter of the English alphabet $y$.
• Replace all occurrences of number $x$ with the letter $y$.

For example, if we initially had an array $a=\left[2,3,2,4,1\right]$, then we could transform it the following way:

• Choose the number $2$ and the letter c. After that $a=\left[c,3,c,4,1\right]$.
• Choose the number $3$ and the letter a. After that $a=\left[c,a,c,4,1\right]$.
• Choose the number $4$ and the letter t. After that $a=\left[c,a,c,t,1\right]$.
• Choose the number $1$ and the letter a. After that $a=\left[c,a,c,t,a\right]$.

After the transformation all letters are united into a string, in our example we get the string "cacta".

Having the array $a$ and the string $s$ determine if the string $s$ could be got from the array $a$ after the described transformation?

Input

The first line contains a single integer $t$ $\left(1\le t\le {10}^{3}$) — the number of test cases.

Then the description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1\le n\le 50$) — the length of the array $a$ and the string $s$.

Solution Click Below:-  👉
👇👇👇👇👇

The second line of each test case contains exactly $n$ integers: ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($1\le {a}_{i}\le 50$) — the elements of the array $a$.

The third line of each test case contains a string $s$ of length $n$, consisting of lowercase English letters.

Output

For each test case, output "YES", if we can get the string $s$ from the array $a$, and "NO" otherwise. You can output each letter in any case.

Note

The first test case corresponds to the sample described in the statement.

In the second test case we can choose the number $50$ and the letter a.

In the third test case we can choose the number $11$ and the letter a, after that $a=\left[a,22\right]$. Then we choose the number $22$ and the letter b and get $a=\left[a,b\right]$.

In the fifth test case we can change all numbers one by one to the letter a.