#K90872. Anagram Checker

    ID: 37849 Type: Default 1000ms 256MiB

Anagram Checker

Anagram Checker

You are given several test cases. For each test case, you should determine whether all the given strings are anagrams of each other.

Two strings are anagrams if, after converting all letters to lowercase, removing all spaces, and sorting their characters, they are identical. In other words, for a string \(s\), define its normalized form as

\(normalized(s)=sort(lowercase(s \setminus \text{spaces}))\)

The strings in each test case are anagrams if every string's normalized form equals that of the first string.

Note: A single string is trivially an anagram of itself.

inputFormat

The first line of input contains an integer \(T\) \( (1 \leq T \leq 100)\) representing the number of test cases. Each test case begins with an integer \(N\) \( (1 \leq N \leq 100)\) which denotes the number of strings in that test case. The following \(N\) lines each contain one string. The strings may contain spaces and are case insensitive.

outputFormat

For each test case, output on a new line "YES" if all the strings are anagrams of each other, otherwise output "NO".

## sample
5
3
listen
silent
enlist
2
hello
billion
3
Listen
SiLent
EnlisT
1
word
2
conversation
voices rant on
YES

NO YES YES YES

</p>