{"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\"\u003e\u0026nbsp;\u0026nbsp;Summer again! Flynn is ready for another tour around. Since the tour would take three or more days, it is important to find a hotel that meets for a reasonable price and gets as near as possible! \u003cbr\u003e\u0026nbsp;\u0026nbsp;But there are so many of them! Flynn gets tired to look for any. It’s your time now! Given the \u0026lt;p\u003csub\u003ei\u003c/sub\u003e, d\u003csub\u003ei\u003c/sub\u003e\u0026gt; for a hotel h\u003csub\u003ei\u003c/sub\u003e, where p\u003csub\u003ei\u003c/sub\u003e stands for the price and d\u003csub\u003ei\u003c/sub\u003e is the distance from the destination of this tour, you are going to find those hotels, that either with a lower price or lower distance. Consider hotel h\u003csub\u003e1\u003c/sub\u003e, if there is a hotel h\u003csub\u003ei\u003c/sub\u003e, with both lower price and lower distance, we would discard h1. To be more specific, you are going to find those hotels, where no other has both lower price and distance than it. And the comparison is strict.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are some cases. Process to the end of file.\u003cbr\u003eEach case begin with N (1 \u0026lt;\u003d N \u0026lt;\u003d 10000), the number of the hotel.\u003cbr\u003eThe next N line gives the (p\u003csub\u003ei\u003c/sub\u003e, d\u003csub\u003ei\u003c/sub\u003e) for the i-th hotel.\u003cbr\u003eThe number will be \u003cfont color\u003d\"\u0026quot;red\u0026quot;\"\u003enon-negative\u003c/font\u003e and less than 10000."}},{"title":"Output","value":{"format":"HTML","content":"First, output the number of the hotel you find, and from the next line, print them like the input( two numbers in one line). You should order them ascending first by price and break the same price by distance."}},{"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\u003e3\r\n15 10\r\n10 15\r\n8 9\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n8 9\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}