{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003ePolycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him — his keyboard will consist of only one row, where all $$$26$$$ lowercase Latin letters will be arranged in some order.\u003c/p\u003e\u003cp\u003ePolycarp uses the same password $$$s$$$ on all websites where he is registered (it is bad, but he doesn\u0027t care). He wants to assemble a keyboard that will allow to type this password very easily. He doesn\u0027t like to move his fingers while typing the password, so, for each pair of adjacent characters in $$$s$$$, they should be adjacent on the keyboard. For example, if the password is \u003cspan class\u003d\"tex-font-style-tt\"\u003eabacaba\u003c/span\u003e, then the layout \u003cspan class\u003d\"tex-font-style-tt\"\u003ecabdefghi...\u003c/span\u003e is perfect, since characters \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e are adjacent on the keyboard, and \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e are adjacent on the keyboard. It is guaranteed that there are no two adjacent equal characters in $$$s$$$, so, for example, the password cannot be \u003cspan class\u003d\"tex-font-style-tt\"\u003epassword\u003c/span\u003e (two characters \u003cspan class\u003d\"tex-font-style-tt\"\u003es\u003c/span\u003e are adjacent).\u003c/p\u003e\u003cp\u003eCan you help Polycarp with choosing the perfect layout of the keyboard, if it is possible?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains one integer $$$T$$$ ($$$1 \\le T \\le 1000$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eThen $$$T$$$ lines follow, each containing one string $$$s$$$ ($$$1 \\le |s| \\le 200$$$) representing the test case. $$$s$$$ consists of lowercase Latin letters only. There are no two adjacent equal characters in $$$s$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, do the following:\u003c/p\u003e\u003cul\u003e \u003cli\u003e if it is impossible to assemble a perfect keyboard, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e (in upper case, \u003cspan class\u003d\"tex-font-style-bf\"\u003eit matters in this problem\u003c/span\u003e); \u003c/li\u003e\u003cli\u003e otherwise, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e (in upper case), and then a string consisting of $$$26$$$ lowercase Latin letters — the perfect layout. Each Latin letter should appear in this string exactly once. If there are multiple answers, print any of them. \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\nababa\ncodedoca\nabcda\nzxzytyz\nabcdefghijklmnopqrstuvwxyza\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nbacdefghijklmnopqrstuvwxyz\nYES\nedocabfghijklmnpqrstuvwxyz\nNO\nYES\nxzytabcdefghijklmnopqrsuvw\nNO\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}