Anagrams

Two sentences (or two words) are anagrams if one can be obtained from the other one simply reordering their letters (forgetting the spaces and the punctuation symbols) .

For instance, “ROME” and “MORE” are anagrams. Also, “AVE MARIA, GRATIA PLENA, DOMINUS TECUM” and “VIRGO SERENA, PIA, MUNDA ET IMMACULATA” are anagrams.

Write a program that prints if the pairs are or are not anagrams.

Input

Input starts with a number nn After, each sentence is given in a line ending in a dot. The sentences may contain uppercase letters, spaces and punctuation symbols (but only a dot in the end).

Output

For each pair of sentences, print “YES” if they form an anagram and “NO” otherwise.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:40:44.393Z

© Jutge.org, 2006–2026.
https://jutge.org