By Ricardo Martins, IFSULDEMINAS Brazil
A cosmetic company, called Jetiqui, had a television program that rewarded consultants and clients. This program was called Turn to Wheel. In this program, there was a secret word, and with each round, the wheel was turned, with several prizes, goes the turn and loses everything. If he falls, he does not lose everything, one participant loses all that he has received from the prize pool so far and passes the turn to another participant. If he fell, he would not lose anything, but instead he would try to hit the secret word. If he fell into a prize of value, the participant could say a letter, and if it was part of the secret word, only one of them would be revealed. That is, if the word were banana, it would have to rotate 3 times and say 3 times to reveal all the A's of the word. One day, Pasqualito, with a large Knowledge about words, was to participate in this program. Whenever two letters were missing to be revealed, he had a great guess, of two possibilities, what would be the possible answer. He wanted to know if there was the possibility of risking a letter that would define which of the two words would be correct, because he did not want to risk another round, for fear of passing the turn. For example, the word displayed was _or_e, meaning the first and penultimate letter had not yet been revealed, and the two words he thought were sorte and torre. In this case, he could cure his doubt by speaking the letter T. If the letter appeared at the beginning, the word would be torre, if it appeared in the penultimate, the word would be sorte.
Write a program that, given the incomplete word and both possibilities, tells you if it is possible for Pasqualito to find the right word in the current round.
The first line contains an integer C representing the number of test cases. Each test case has three words, the first two being the words that Pasqualito is in doubt, and the third is the word incomplete. Words have a maximum of 15 letters.
For each test case, print Y if it is possible to solve the doubt, or N if it is not possible.
|Input Sample||Output Sample|