Before we start telling this magnificent tale, we need a few definitions:
Now we shall tell the story of the origin of competitive programming among humans. Legend has it that thousands of years ago, in ancient Nlogonia, the god Rárada constantly invented new problems and algorithms to solve them, sharing these ideas among the gods. It is known that the gods used very few words when communicating with each other, more specifically, the deities only used words from the set $$$U =$$$ {AC, AMOR, BRASILEIRO, CAVALO, MARATONUSP, OSSO, OVO, PATA, RARADA, TLE, VOO}; do not question why they chose these words, and, yes, the gods from Nlogonia spoke portuguese. Among these gods was Promethilio, who, amazed by these new ideas, believed that this knowledge should be passed on to humans. However, fearing that humans would become too powerful, he didn't convey exactly the same message as Rárada. Every time Promethilio heard a phrase $$$T \in U*$$$ from Rárada, he would choose a permutation $$$\mathcal{P}$$$ and send the text $$$\mathcal{P}(T)$$$ to the hero Morethor (perhaps you've heard of him in another question). Morethor would then transcribe the phrase $$$\mathcal{P}(T)$$$ onto stone tablets with the aim of disseminating these ideas and preserving competitive programming knowledge forever.
Otávio, the archaeologist, has found a stone tablet with a text $$$S$$$ and is extremely excited about the possibility of having discovered one of the ancient tablets written by Morethor containing Rárada's foundational ideas. He now needs your help to decide whether he has truly found a historical relic or just an ordinary text.
The input consists of two lines. The first line contains an integer $$$N$$$. The second line contains the text $$$S$$$ written on the tablet. The text contains exactly $$$N$$$ words and $$$1 \leq |S| \leq 10^6$$$, meaning the text has between 1 and 1000000 characters. All characters are uppercase letters or whitespace. All words are separated by exactly one space.
If there exists a text $$$T \in U*$$$ and a permutation $$$\mathcal{P}$$$ such that $$$\mathcal{P}(T) = S$$$, the output should consist of two lines: the first line should print "Y", and the second line should contain the permutation $$$\mathcal{P}$$$ in the format "$$$\mathcal{P}[1]\mathcal{P}[2] ... \mathcal{P}[26]$$$". If for any text $$$T \in U*$$$ and any permutation $$$\mathcal{P}$$$ we have $$$\mathcal{P}(T) \neq S$$$, then the output should be a single line containing "N".
3 NBSBUPOVTQ PWP BD
Y BCDEFGHIJKLMNOPQRSTUVWXYZA
2 BD CMOR
N
6 PSDETVXTSQ DHQS SDSDRD QEEQ ADKD DG
Y DPGRXBCFTIJVHLQAMSEKNOUWYZ
2 OSSO PATA
Y ABCDEFGHIJKLMNOPQRSTUVWXYZ
In the first test case, the phrase spoken by Rárada was MARATONUSP OVO AC. In the second test case, there is no permutation that would lead a phrase spoken by Rárada to the input text. In the third test case, the phrase spoken by Rárada was BRASILEIRO AMOR RARADA OSSO PATA AC.
For the positive cases, note that multiple permutations could be accepted as an answer.