Spoonerisms

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

A spoonerism (named after William Archibald Spooner, an Oxford pastor who had a habit of inadvertently inventing more of them) is a pair of words that you can change into another pair by swapping their beginnings, for example a "blushing crow" becomes a "crushing blow".

Given a list of words, find a spoonerism among them. Formally: find a pair (A,B)(A,B) of words from the list which can be split into A=pqA = pq and B=rsB = rs in such a manner that the words C=rqC = rq and D=psD = ps are also on the list. We allow only true spoonerisms, that is, those with prp \neq r, sqs \neq q and p,q,r,sp, q, r, s nonempty.

입력

The first line of input contains the number of test cases zz. The descriptions of the test cases follow.

The first line of each test case contains the length of the list nn (1n500,0001 \leq n \leq 500\\,000). Each of the following nn lines contains a single word composed of small English letters. The total length of words in all test cases does not exceed 500,000500\\,000.

출력

For each test case, if no spoonerism can be found, output "NO" on a single line. If there is a spoonerism, output a line containing "YES", followed by a line containing words AA and BB, and another one containing CC and DD. If there are multiple solutions, output any one of them. You may also safely switch the word order in any line.