{"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\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\u003eYou are given $$$n$$$ pairs of integers $$$(a_1, b_1), (a_2, b_2), \\ldots, (a_n, b_n)$$$. All of the integers in the pairs are distinct and are in the range from $$$1$$$ to $$$2 \\cdot n$$$ inclusive.\u003c/p\u003e\u003cp\u003eLet\u0027s call a sequence of integers $$$x_1, x_2, \\ldots, x_{2k}$$$ \u003cspan class\u003d\"tex-font-style-it\"\u003egood\u003c/span\u003e if either \u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$x_1 \u0026lt; x_2 \u0026gt; x_3 \u0026lt; \\ldots \u0026lt; x_{2k-2} \u0026gt; x_{2k-1} \u0026lt; x_{2k}$$$, or \u003c/li\u003e\u003cli\u003e $$$x_1 \u0026gt; x_2 \u0026lt; x_3 \u0026gt; \\ldots \u0026gt; x_{2k-2} \u0026lt; x_{2k-1} \u0026gt; x_{2k}$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou need to choose a subset of distinct indices $$$i_1, i_2, \\ldots, i_t$$$ and \u003cspan class\u003d\"tex-font-style-bf\"\u003etheir order\u003c/span\u003e in a way that if you write down all numbers from the pairs in a single sequence (the sequence would be $$$a_{i_1}, b_{i_1}, a_{i_2}, b_{i_2}, \\ldots, a_{i_t}, b_{i_t}$$$), this sequence is good.\u003c/p\u003e\u003cp\u003eWhat is the largest subset of indices you can choose? You also need to construct the corresponding index sequence $$$i_1, i_2, \\ldots, i_t$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains single integer $$$n$$$ ($$$2 \\leq n \\leq 3 \\cdot 10^5$$$)\u0026nbsp;— the number of pairs.\u003c/p\u003e\u003cp\u003eEach of the next $$$n$$$ lines contain two numbers\u0026nbsp;— $$$a_i$$$ and $$$b_i$$$ ($$$1 \\le a_i, b_i \\le 2 \\cdot n$$$)\u0026nbsp;— the elements of the pairs.\u003c/p\u003e\u003cp\u003eIt is guaranteed that all integers in the pairs are distinct, that is, every integer from $$$1$$$ to $$$2 \\cdot n$$$ is mentioned exactly once.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eIn the first line print a single integer $$$t$$$\u0026nbsp;— the number of pairs in the answer.\u003c/p\u003e\u003cp\u003eThen print $$$t$$$ distinct integers $$$i_1, i_2, \\ldots, i_t$$$\u0026nbsp;— the indexes of pairs in the corresponding order.\u003c/p\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\u003e5\n1 7\n6 4\n2 10\n9 8\n3 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n1 5 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\n5 4\n3 2\n6 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n3 2 1\n\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\u003eThe final sequence in the first example is $$$1 \u0026lt; 7 \u0026gt; 3 \u0026lt; 5 \u0026gt; 2 \u0026lt; 10$$$.\u003c/p\u003e\u003cp\u003eThe final sequence in the second example is $$$6 \u0026gt; 1 \u0026lt; 3 \u0026gt; 2 \u0026lt; 5 \u0026gt; 4$$$.\u003c/p\u003e"}}]}