{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"epigraph\"\u003e\u003cdiv class\u003d\"epigraph-text\"\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eOur doubts are traitors, and make us lose the good we oft might win, by fearing to attempt.\u003c/span\u003e\u003c/div\u003e\u003cdiv class\u003d\"epigraph-source\"\u003e— William Shakespeare, \u003cspan class\u003d\"tex-font-style-it\"\u003eMeasure for Measure\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cp\u003eFeeling a little bored, \u003cspan class\u003d\"tex-font-style-it\"\u003eWX\u003c/span\u003e decided to play a game called \"Chain Reaction\".\u003c/p\u003e\u003cp\u003eThe game is based on a classic question \"Toggle Lamps\". There are $$$n$$$ lamps in total. Initially, all of them are turned off.\u003c/p\u003e\u003cp\u003eAlso, there are $$$n$$$ buttons. If you push the $$$i$$$-th button, then all lamps $$$x$$$ such that $$$x$$$ is a \u003cspan class\u003d\"tex-font-style-bf\"\u003emultiple\u003c/span\u003e of $$$i$$$ will be toggled.\u003c/p\u003e\u003cp\u003eYou have to push some button according to the following rules:\u003c/p\u003e\u003col\u003e \u003cli\u003e You need to push at least one button; \u003c/li\u003e\u003cli\u003e A button can be pushed \u003cspan class\u003d\"tex-font-style-bf\"\u003eonly once\u003c/span\u003e; \u003c/li\u003e\u003cli\u003e You are given $$$m$$$ pairs $$$(u_i, v_i)$$$, if you push the button $$$u_i$$$, then you have to push the button $$$v_i$$$ (at any moment, not necessarily after pushing the button $$$u_i$$$). Note that if you push the button $$$v_i$$$, then you don\u0027t have to push the button $$$u_i$$$ for the given pair $$$(u_i, v_i)$$$. \u003c/li\u003e\u003c/ol\u003e \u003cp\u003eFind a way to push buttons such that \u003cspan class\u003d\"tex-font-style-bf\"\u003eat most\u003c/span\u003e $$$\\lfloor \\sqrt{n} \\rfloor$$$ lamps$$$^{\\dagger}$$$ are on, or print $$$-1$$$ if it is impossible.\u003c/p\u003e\u003cp\u003e$$$^{\\dagger}$$$ $$$\\lfloor x \\rfloor$$$ denotes the round down operation.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ $$$(1 \\leq t \\leq 10^4)$$$, denoting the number of test cases.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains two integers $$$n$$$, $$$m$$$ $$$(1 \\leq n \\leq 2 \\times 10 ^ 5, 0 \\leq m \\leq 2 \\times 10 ^ 5)$$$, denoting the number of lamps and the number of pairs.\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$u_i$$$, $$$v_i$$$ $$$(1 \\leq u_i, v_i \\leq n, u_i \\neq v_i)$$$. If you push the button $$$u_i$$$, then you have to push the button $$$v_i$$$. It\u0027s guaranteed that the pairs $$$(u_i, v_i)$$$ are distinct.\u003c/p\u003e\u003cp\u003eIt\u0027s guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases doesn\u0027t exceed $$$2 \\times 10 ^ 5$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, output a single line:\u003c/p\u003e\u003cul\u003e \u003cli\u003e If it is impossible, then output $$$-1$$$; \u003c/li\u003e\u003cli\u003e Otherwise, first output an integer $$$k$$$, denoting the number of buttons you push. Then output $$$k$$$ integers $$$b_i$$$, denoting the buttons you push. You can output in any order. Note that all $$$b_i$$$ must be distinct, and at last there will be at most $$$\\lfloor \\sqrt n \\rfloor$$$ lamps that are on. \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\u003e1\n4 2\n1 2\n4 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 4 3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first test case, there are $$$4$$$ lamps and $$$2$$$ pairs in total. $$$\\lfloor \\sqrt{4} \\rfloor \u003d 2$$$.\u003c/p\u003e\u003cp\u003eOne possible way is:\u003c/p\u003e\u003col\u003e \u003cli\u003e Push the button $$$4$$$. After that, the lamp $$$4$$$ will be toggled on; \u003c/li\u003e\u003cli\u003e Push the button $$$3$$$. After that, the lamp $$$3$$$ will be toggled on (satisfy the $$$2$$$-th pair). \u003c/li\u003e\u003c/ol\u003e\u003cp\u003eAnother possible way is just to push the button $$$2$$$. After that, the lamp $$$2, 4$$$ will be toggled on ($$$4$$$ is a multiple of $$$2$$$). Note that you don\u0027t need to push the button $$$1$$$.\u003c/p\u003e\u003cp\u003eThese are not the only possible ways.\u003c/p\u003e"}}]}