{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003e\u003ci\u003eRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…\u003c/i\u003e\u003c/p\u003e\n \u003cp\u003eThe Lunar New Year was approaching, but unluckily the Little Cat still had schedules going here and there. Now, he had to travel by train to Mianyang, Sichuan Province for the winter camp selection of the national team of Olympiad in Informatics.\u003c/p\u003e\n \u003cp\u003eIt was one o’clock a.m. and dark outside. Chill wind from the northwest did not scare off the people in the queue. The cold night gave the Little Cat a shiver. Why not find a problem to think about? That was none the less better than freezing to death!\u003c/p\u003e\n \u003cp\u003ePeople kept jumping the queue. Since it was too dark around, such moves would not be discovered even by the people adjacent to the queue-jumpers. “If every person in the queue is assigned an integral value and all the information about those who have jumped the queue and where they stand after queue-jumping is given, can I find out the final order of people in the queue?” Thought the Little Cat.\u003c/p\u003e\n \u003c/div\u003e\n有n个人,在插队。输出最后队伍中,所有人的val。"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eThere will be several test cases in the input. Each test case consists of \u003ci\u003eN\u003c/i\u003e + 1 lines where \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 200,000) is given in the first line of the test case. The next \u003ci\u003eN\u003c/i\u003e lines contain the pairs of values \u003ci\u003ePos\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e and \u003ci\u003eVal\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e in the increasing order of \u003ci\u003ei\u003c/i\u003e (1 ≤ \u003ci\u003ei\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e). For each \u003ci\u003ei\u003c/i\u003e, the ranges and meanings of \u003ci\u003ePos\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e and \u003ci\u003eVal\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e are as follows:\u003c/p\u003e\n \u003cul\u003e\n \u003cli\u003e\u003ci\u003ePos\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ∈ [0, \u003ci\u003ei\u003c/i\u003e − 1] — The \u003ci\u003ei\u003c/i\u003e-th person came to the queue and stood right behind the \u003ci\u003ePos\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e-th person in the queue. The booking office was considered the 0th person and the person at the front of the queue was considered the first person in the queue.\u003c/li\u003e\n \u003cli\u003e\u003ci\u003eVal\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ∈ [0, 32767] — The \u003ci\u003ei\u003c/i\u003e-th person was assigned the value \u003ci\u003eVal\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e.\u003c/li\u003e\n \u003c/ul\u003e\n \u003cp\u003eThere no blank lines between test cases. Proceed to the end of input.\u003c/p\u003e\n \u003c/div\u003e\n第一行一个整数N,表示n个人\n接下来n行,每行两个整数x和val,表示一个标记为val的人,插入到排在第x位置的人的后面。"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eFor each test cases, output a single line of space-separated integers which are the values of people in the order they stand in the queue.\u003c/p\u003e\n \u003c/div\u003e\n从前往后,输出所有的val"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n0 77\n1 51\n1 33\n2 69\n4\n0 20523\n1 19243\n1 3890\n0 31492\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e77 33 69 51\n31492 20523 3890 19243\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eThe figure below shows how the Little Cat found out the final order of people in the queue described in the first test case of the sample input.\u003c/p\u003e\n \u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/b9016c4cbefd63dba96b117b503374d9?v\u003d1531480294\" SRC\u003d\"CDN_BASE_URL/b9016c4cbefd63dba96b117b503374d9?v\u003d1531480294\"\u003e\n \u003c/center\u003e\n \u003c/div\u003e"}}]}