{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eKlee likes toys. Klee\u0027s mom, Alice bought her a new toy from Sumeru.\u003cbr\u003e\u003cbr\u003eThe toy is a $4\\times 4\\times 4$ cube. The cube can be divided into $13$ different parts of the blocks.\u003cbr\u003e\u003cbr\u003eThe $13$ blocks are shown in the figure.\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/0382884d13c84d8025cd451a35c1fada?v\u003d1726136963\"\u003e\u003c/center\u003e \u003cbr\u003e\u003cbr\u003eEach block can be placed anywhere in the cube, but cannot overlap.\u003cbr\u003e\u003cbr\u003eKlee can freely rotate the blocks and use a kind of magic, mirror magic. After using mirror magic, the blocks will flip symmetrically. For example, block F is shown in the figure after using mirror magic.\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/c3335c9db7fa2e09d4eb65361230cba5?v\u003d1726136963\"\u003e\u003c/center\u003e \u003cbr\u003e\u003cbr\u003eAt the beginning, Alice has put some blocks in place. Klee needs to put the remaining blocks into a $4\\times 4\\times 4$ cube. \u003cbr\u003e\u003cbr\u003eUsing Astrology, Alice knew the number of solutions will not exceed $500$.\u003cbr\u003e\u003cbr\u003eKlee wants to know all the solutions of this puzzle, but it is too difficult for Klee. Please help her.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Each test contains multiple test cases. The first line contains the number of test cases $T(1 \\le T \\le 10)$. Description of the test cases follows.\u003cbr\u003e\u003cbr\u003eThere are $16$ lines in a case. Each line contains a string of $4$ characters. Every $4$ lines describe one layer of the cube from top to bottom. \u003cbr\u003e\u003cbr\u003eEach input character may only be upper-case letters from \"A\" to \"M\" or \".\".\u003cbr\u003e\u003cbr\u003e\"A\" to \"M\" are indicating the blocks in the figure above and \".\" are indicating the position is empty."}},{"title":"Output","value":{"format":"HTML","content":"For each test case:\u003cbr\u003e\u003cbr\u003eIf it\u0027s impossible to solve the puzzle, print \"No Solution!\" in a single line (without quotes).\u003cbr\u003e\u003cbr\u003eOtherwise, print the number of solutions in the first line.\u003cbr\u003e\u003cbr\u003eThen for each solution, print $16$ lines. Each line contains a string of $4$ characters. Every $4$ lines describe one layer of the cube from top to bottom.\u003cbr\u003e\u003cbr\u003eEach input character may only be upper-case letters from \"A\" to \"M\", indicating the blocks in the figure above.\u003cbr\u003e\u003cbr\u003eThe output format of block is the same as input.\u003cbr\u003e\u003cbr\u003eIf there are multiple solutions, print them in the lexicographical order."}},{"title":"Sample","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\u003e2\r\nE...\r\nEEE.\r\nE...\r\n...L\r\nE...\r\n....\r\n....\r\n...L\r\nJJ..\r\nGJ..\r\nGII.\r\nHIIL\r\nJJ..\r\nJJ..\r\nGII.\r\nHIIM\r\nE...\r\nEEE.\r\nE...\r\n...L\r\nE...\r\n....\r\n....\r\n...L\r\nJJ..\r\nGJ..\r\nG...\r\nH..L\r\nJJ..\r\nJJ..\r\nG...\r\nH..M\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\nECCC\r\nEEEC\r\nEDDD\r\nBDDL\r\nECKK\r\nAAAA\r\nBDDA\r\nBBBL\r\nJJKK\r\nGJFA\r\nGIIA\r\nHIIL\r\nJJKK\r\nJJFF\r\nGIIF\r\nHIIM\r\n2\r\nECCC\r\nEEEC\r\nEDDD\r\nBDDL\r\nECKK\r\nAAAA\r\nBDDA\r\nBBBL\r\nJJKK\r\nGJFA\r\nGIIA\r\nHIIL\r\nJJKK\r\nJJFF\r\nGIIF\r\nHIIM\r\n\r\nEKKK\r\nEEEA\r\nEBBA\r\nDDBL\r\nEKKK\r\nAAAA\r\nDDBA\r\nDDDL\r\nJJII\r\nGJII\r\nGFBC\r\nHFFL\r\nJJII\r\nJJII\r\nGCCC\r\nHCFM\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003e3D Model for the first example.\u003cbr\u003eDownload and open it with paint 3D.\u003cbr\u003ehttps://share.weiyun.com/5iX1150Z\u003cbr\u003e"}}]}