C :: Pausotopic messages

Time Limit: 1 Second    Memory Limit: 32768 KB

Due to the increased availability of mobile phones and the decreased cost of short message services (SMS), text messaging is getting more and more popular. To do text messaging, one of course needs a text entry system in his mobile phone. One well-known text entry system is multi-tap in which letters are printed on 8 keys in either 3-letter or 4-letter sequences as depicted in the figure. The system is used by repeatedly pressing the same key to cycle through the letters for that key. For example, pressing the key "4" twice would indicate the letter "H". Pausing more than a threshold time automatically chooses the current letter in the cycle, as pressing a different key. If someone is not careful about the threshold time, he may enter a wrong text due to long or short unwanted pauses in pressing keys. For example, if he wants to type "C", the key "2" must be pressed 3 times but long unwanted pauses while pressing key "2" may produce "AAA", "AB" or "BA". As another example, if he wants to type "QP", a short pause after the second pressing of key "7" may produce "R".

http://sharecode.ir/assets/problem_images/2011_f81c79c0ba40819a9df62f4cde35790f.jpg

Two messages are called pausotopic if and only if making pauses shorter or longer while typing one of the two given messages produces the other message. Your task is to determine whether the two given messages are pausotopic. You may assume each letter in both messages is typed with the minimum number of pressing, i.e., a letter is not typed with cycling letters on a key several times For instance, although ā€œUā€ can be typed by pressing ā€œ8ā€ five times, this assumption says "U" is typed with pressing "8" twice.

Input

The input consists of several test cases. The first line of the input consists of a single integer n which is the number of test cases. Each test case consists of two words given in two consecutive lines. Each word is a string of capital letters (A-Z) with size at least 1 and at most 150.

Output

For each test case, in a single line output "YES" if the given two words are pausotopic; otherwise, output "NO".

Sample Input

3
QQ
PS
AAAAA
CC
ABC
CBA

Sample Output

NO
NO
YES
Submit

Source: Tehran, Asia Region - Regional 2011