{"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\"\u003eGiven a \u003ca href\u003d\"http://en.wikipedia.org/wiki/Tournament_(graph_theory)\"\u003etournament\u003c/a\u003e, you need to determine the direction of the remaining sides to maximize the answer. The answer is calculated in the following way. The vertices are labeled from $0$ to $n-1$, and the matrix $s$ is used to represent the edges.\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/b860d7d20bf55fd0833b3c0bcbaf3752?v\u003d1715768832\"\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of input is a single line of integer $T (2 \\le T \\le 10)$, the number of test cases. In each test case, there are $1$ integers $n(5 \\le n \\le 200)$, denoting the number of vertices. Then in the following $n$ lines, the $i$-th line has a string of length $n$. If $s[i][j]\u003d1$, there is an edge from $i$ to $j$. If $s[i][j]\u003d2$ means you need to determine the direction for that edge. The input is guaranteed to be legal, and the number of $(i, j) (i \u0026lt; j)$ satisfying $s[i][j]\u003ds[j][i]\u003d2$ is less than $200$. The data is \u003cb\u003erandomly\u003c/b\u003e generated."}},{"title":"Output","value":{"format":"HTML","content":"For each set of test samples, output one line to represent the maximized answer."}},{"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\n5\r\n02112\r\n20221\r\n02001\r\n02102\r\n20020\r\n5\r\n01112\r\n00022\r\n01012\r\n02002\r\n22220\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e40\r\n24\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\u003eOne solution to the first case is:\u003cbr\u003e00110\u003cbr\u003e10001\u003cbr\u003e01001\u003cbr\u003e01100\u003cbr\u003e10010\u003cbr\u003e"}}]}