{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n Sudoku is a logic-based, combinatorial number-placement puzzle, which is popular around the world. \n \u003cbr\u003eIn this problem, let us focus on puzzles with $16 \\times 16$ grids, which consist of $4 \\times 4$ regions. The objective is to fill the whole grid with hexadecimal digits, i.e. 0123456789ABCDEF, so that each column, each row, and each region contains all hexadecimal digits. The figure below shows a solved sudoku. \n \u003cbr\u003e \n \u003cbr\u003e \n \u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/3f4cdee064d2c6e6f87b78750384831a?v\u003d1572773922\"\u003e \n \u003c/center\u003e \n \u003cbr\u003e \n \u003cbr\u003eYesterday, Kazari solved a sudoku and left it on the desk. However, Minato played a joke with her - he performed the following operation several times. \n \u003cbr\u003e* Choose a region and rotate it by 90 degrees counterclockwise. \n \u003cbr\u003eShe burst into tears as soon as she found the sudoku was broken because of rotations. \n \u003cbr\u003eCould you let her know how many operations her brother performed at least? \n \u003cbr\u003e现在有个已经完成的16×16的数独(即满足数独的要求),它的某些部分被逆时针旋转过了。已知每次旋转的角度为90°,问最少经过多少次旋转能将它转回原样。\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains an integer T (1 \u003c\u003d T \u003c\u003d 10 ^ 3) denoting the number of test cases. T为样例数\n\u003cbr\u003eEach test case consists of exactly 16 lines with 16 characters each, describing a broken sudoku. 每个样例都是16*16的数据\n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print a non-negative integer indicating the minimum possible number of operations. 输出他们最小操作数\n\u003cbr\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e1\n681D5A0C9FDBB2F7\n0A734B62E167D9E5\n5C9B73EF3C208410\nF24ED18948A5CA63 \n39FAED5616400B74 \nD120C4B7CA3DEF38 \n7EC829A085BE6D51 \nB56438F129F79C2A \n5C7FBC4E3D08719F \nAE8B1673BF42A58D \n60D3AF25619C30BE\n294190D8EA57264C \nC7D1B35606835EAB \nAF52A1E019BE4306 \n8B36DC78D425F7C9 \nE409492FC7FA18D2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e5\n\n\n \n \u003ci style\u003d\"font-size:1px\"\u003e \u003c/i\u003e\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cpre\u003e\nThe original sudoku is same as the example in the statement.\n\n \n \u003ccenter\u003e\n \n \u003cimg SRC\u003d\"CDN_BASE_URL/a902e594f4cf9addbe8dc24c7cfc0f72?v\u003d1572773922\"\u003e\n \n \u003c/center\u003e\n\n \n \u003c/pre\u003e"}}]}