#K95307. Shifting Strings

    ID: 38834 Type: Default 1000ms 256MiB

Shifting Strings

Shifting Strings

You are given t test cases. For each test case, you are provided with two strings a and b. Your task is to determine whether they are shifting strings of each other.

Two strings are considered shifting strings if and only if they have the same length and contain the same characters with the same frequency (i.e. they are anagrams of each other). The comparison is case-sensitive.

For example, "abc" and "bca" are shifting strings, while "abc" and "def" are not.

inputFormat

The first line contains an integer t, the number of test cases. Each of the following t lines contains two space-separated strings a and b.

outputFormat

For each test case, output a single line containing "YES" if the two strings are shifting strings of each other; otherwise, output "NO".

## sample
3
abc bca
aabbcc bbccaa
abc def
YES

YES NO

</p>