{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eAfter Handsome Qw Chen graduated from college, he went to work in a bank.\u003cbr\u003e\nThere are too many people waiting in line at the bank every day, so H.Q.Chen has a lot of trouble.\u003cbr\u003e\nOne day, due to a mistake in his work, he ordered a client from eight o \u0027clock in the morning to line up at 5pm.\u003cbr\u003e\nThe client complained about him, he was scolded by the manager and the bank President canceled his salary in this month.\u003cbr\u003e\nHe is very regretful for his bad study at university.\u003cbr\u003e\nSo he found you and asked you to help him write a program and He took out his three - month salary for you.\u003cbr\u003e\n\u003c/p\u003e\n \u003ctable style\u003d\"border-collapse: collapse;\" border\u003d\"1\" bordercolor\u003d\"#000000\"\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e0\u003c/td\u003e\n \u003ctd\u003eThe program needs to stop serving\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e1 \u003ci\u003eK\u003c/i\u003e \u003ci\u003eP\u003c/i\u003e\u003c/td\u003e\n \u003ctd\u003eAdd client \u003ci\u003eK\u003c/i\u003e to the waiting roster with priority \u003ci\u003eP\u003c/i\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e2\u003c/td\u003e\n \u003ctd\u003eServe the client with the supreme priority and expurgate him or her from the waiting roster\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e3\u003c/td\u003e\n \u003ctd\u003eServe the client with the lowermost priority and expurgate him or her from the waiting roster\u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n \u003cp\u003eYour labor is to help H.Q.Chen by coding a program to perform the requested serving policy.\u003c/p\u003e\n \u003c/div\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eEach line of the input involves one of the possible requests.\u003cbr\u003eOnly the last line contains the stop-request which is code 0. You may assume when there is a request to include a new client in the roster (code 1), there is no other request in the roster of the same client or with the same priority. An identifier K is always less than 1000000, and a priority P is less than 10000000. The client may arrive for being served multiple times, and each time may acquire a different priority.\n\u003c/p\u003e\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eFor each request with code 2 or 3, the program need to print, in a separate line of the criterion output, the identifier of the served client. \u003cbr\u003eIf the request arrives when the waiting roster is empty,\u003cbr\u003e then the program prints zero (0) to the output.\u003c/p\u003e\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e2\n1 20 14\n1 30 3\n2\n1 10 99\n3\n2\n2\n0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e0\n20\n30\n10\n0\u003c/pre\u003e"}},{"title":"Follow up","value":{"format":"HTML","content":"\u003cp\u003eYou succeeded in helping him solve the problem and you promised to reminisce with him tomorrow....\u003cbr\u003e\nIf you see this question many years later, will you recall the winter of 2017-2018?\u003cbr\u003e\nHope the 17 days of experience can become your forever memory.\u003cbr\u003e\n\u003cimg src\u003d\"http://imgsrc.baidu.com/image/c0%3Dpixel_huitu%2C0%2C0%2C294%2C40/sign\u003d92648692083b5bb5aada28be5fabb055/77094b36acaf2edd199cced0861001e93901939e.jpg\" width\u003d\"400\" height\u003d\"280\"\u003e\n\u003c/p\u003e \u003c/div\u003e"}}]}