{"trustable":false,"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\u003e给定一个巨大的整数 $$$a$$$,由 $$$n$$$ 位数字组成($$$n$$$ 介于 $$$1$$$ 到 $$$3 \\cdot 10^5$$$ 之间,包括边界值)。整数 $$$a$$$ 可能包含前导零。\u003c/p\u003e\u003cp\u003e如果相邻位置上的两个数字的奇偶性不同(即它们被 $$$2$$$ 除的余数不同),你可以交换这两个数字。\u003c/p\u003e\u003cp\u003e例如,如果 $$$a \u003d 032867235$$$,你可以在一次操作中得到以下整数:\u003c/p\u003e\u003cul\u003e \u003cli\u003e 如果交换第一位和第二位的数字,得到 $$$302867235$$$; \u003c/li\u003e\u003cli\u003e 如果交换第二位和第三位的数字,得到 $$$023867235$$$; \u003c/li\u003e\u003cli\u003e 如果交换第五位和第六位的数字,得到 $$$032876235$$$; \u003c/li\u003e\u003cli\u003e 如果交换第六位和第七位的数字,得到 $$$032862735$$$; \u003c/li\u003e\u003cli\u003e 如果交换第七位和第八位的数字,得到 $$$032867325$$$。 \u003c/li\u003e\u003c/ul\u003e\u003cp\u003e注意,你不能交换位置 $$$2$$$ 和 $$$4$$$ 上的数字,因为它们不相邻。另外,你也不能交换位置 $$$3$$$ 和 $$$4$$$ 上的数字,因为它们的奇偶性相同。\u003c/p\u003e\u003cp\u003e你可以进行任意次数(可能为零次)的这样的操作。\u003c/p\u003e\u003cp\u003e请找出,你可以得到的最小整数。\u003c/p\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e注意,得到的整数也可能包含前导零。\u003c/span\u003e\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数 $$$t$$$($$$1 \\le t \\le 10^4$$$)— 输入中的测试用例数。\u003c/p\u003e\u003cp\u003e每个测试用例的唯一一行包含整数 $$$a$$$,其长度 $$$n$$$ 介于 $$$1$$$ 到 $$$3 \\cdot 10^5$$$ 之间,包括边界值。\u003c/p\u003e\u003cp\u003e保证所有值 $$$n$$$ 的总和不超过 $$$3 \\cdot 10^5$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,输出一行 — 你可以得到的最小整数。\u003c/p\u003e"}},{"title":"示例 1","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\u003e3\n0709\n1337\n246432\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0079\n1337\n234642\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e在第一个测试用例中,你可以执行以下操作序列(被交换的数字对已高亮显示):$$$0 \\underline{\\textbf{70}} 9 \\rightarrow 0079$$$。\u003c/p\u003e\u003cp\u003e在第二个测试用例中,初始整数就是最优的。\u003c/p\u003e\u003cp\u003e在第三个测试用例中,你可以执行以下操作序列:$$$246 \\underline{\\textbf{43}} 2 \\rightarrow 24 \\underline{\\textbf{63}}42 \\rightarrow 2 \\underline{\\textbf{43}} 642 \\rightarrow 234642$$$。\u003c/p\u003e"}}]}