#C10710. Permutation Verification Problem

    ID: 39946 Type: Default 1000ms 256MiB

Permutation Verification Problem

Permutation Verification Problem

You are given two strings, and your task is to check whether the second string is a permutation of the first one. In other words, determine if by rearranging the characters of the first string you can obtain the second string. Formally, given two strings \(a\) and \(b\), we need to verify if:

$$sorted(a) = sorted(b)$$

If the condition holds, output YES; otherwise, output NO.

Read the number of test cases, and for each test case, process two strings (each on a separate line). Print the result for each test case on a new line.

inputFormat

The first line contains an integer \(T\) denoting the number of test cases. The following \(2 \times T\) lines contain two strings per test case. Each test case is given as two consecutive lines: the first string and then the second string.

outputFormat

For each test case, output a single line containing either YES if the second string is a permutation of the first string, or NO otherwise.

## sample
3
listen
silent
triangle
integral
apple
pale
YES

YES NO

</p>