链接:https://codeforces.com/contest/1263/problem/D
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of nn passwords — strings, consists of small Latin letters.
Hacker went home and started preparing to hack AtForces. He found that the system contains only passwords from the stolen list and that the system determines the equivalence of the passwords aa and bb as follows:
- two passwords aa and bb are equivalent if there is a letter, that exists in both aa and bb;
- two passwords aa and bb are equivalent if there is a password cc from the list, which is equivalent to both aa and bb.
If a password is set in the system and an equivalent one is applied to access the system, then the user