Jeremy really likes the Swedish rock band ABBA. So much so, he is obsessed with strings consisting of the letters
B. He has 2 strings ~S~ and ~T~, where ~S~ and ~T~ both only have either
B for its letters, and ~T~ is longer or as long as ~S~. Jeremy has 2 types of operations. The first operation adds an
A to the end of the string. The second operation reverses the string, and then adds a
B to the end of the string. He wonders if there is a sequence of operations to transform ~S~ to ~T~.
The first line will be the integer ~N (1\leq N \leq5)~, the number test cases. The next ~2N~ lines contains strings ~S~ and ~T~, each on a separate line with ~S~ before ~T~. The length of ~S~ and ~T~ are at most ~1000~. ~50~% of points will have the length of ~S~ and ~T~ at most ~10~.
YES if there is ~S~ can be transformed to ~T~,
Sample Input 1
3 ABBA ABBAAAA AB BABA A B
Sample Output 1
YES YES NO