{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eRooms of the Ministry of Magic are enchanted with a spell which\r\nenumerates them automatically. The spell works as follows. The\r\nfirst room created at the Ministry got the number 1. When a\r\nnew room is created by magic, a number-plate appears at once\r\nupon the door. The new number is greater by one than the maximal\r\nroom number existing at the moment. If a room is not needed anymore,\r\nthen it is destroyed and all the room numbers that are greater\r\nthan the number of the destroyed room are lessened by one. Thus,\r\nthe numeration of the rooms at the Ministry always remains continuous.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eHarry Potter found out a list of the numbers of the rooms where\r\nLord Voldemort\u0027s Horcruxes are stored (A Horcrux is a magical artifact that provides for the owner\u0027s immortality). \r\nIt seems that now it will be easy for Harry to find the Horcruxes\r\nand destroy them. But the task turned out to be more complicated.\r\nBecause of his mysterious bond with Harry, Voldemort knew at once\r\nabout Harry\u0027s discovery, so he transported himself to the Ministry and\r\nstarted to destroy rooms. This means that numbers of rooms are\r\nchanging, so when Harry looks at a room\u0027s door, he doesn\u0027t know\r\nwhich number this door had before. But he knows which numbers were on the \r\ndoors of the rooms that were destroyed by Voldemort, due to the\r\nmentioned bond between them.\r\n\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eHelp Harry to defeat Voldemort. You don\u0027t have to fight Harry\u0027s\r\nenemy, but you can help him to determine the true numbers of rooms\r\nwhen he looks at their doors.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains the number of rooms at the Ministry of\r\nMagic \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 10\u003csup\u003e9\u003c/sup\u003e) and a number \u003ci\u003eM\u003c/i\u003e (1 ≤ \u003ci\u003eM\u003c/i\u003e ≤ 10\u003csup\u003e5\u003c/sup\u003e). Each of the subsequent \u003ci\u003eM\u003c/i\u003e lines has the following format:\u003cbr\u003e\r\n\u0026lt;letter\u0026gt; \u0026lt;number\u0026gt;\u003cbr\u003e\r\nwhere \u0026lt;letter\u0026gt; is one of the letters \u0027D\u0027 (Destroy) or \u0027L\u0027 (Look at),\r\nand \u0026lt;number\u0026gt; is the number on the door of the room which is\r\ndestroyed or at which Harry looks at the moment. It is guaranteed\r\nthat not more than 10\u003csup\u003e4\u003c/sup\u003e rooms will be destroyed during the battle.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe output must contain for each line\u003cbr\u003e\r\nL \u0026lt;number\u0026gt;\u003cbr\u003e\r\nof the input the true number (which it had before the\r\nbattle) of the room at which Harry looks.\r\nThe numbers must be given one in a line.\u003c/div\u003e\u003c/div\u003e"}},{"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\u003e20 7\r\nL 5\r\nD 5\r\nL 4\r\nL 5\r\nD 5\r\nL 4\r\nL 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\r\n4\r\n6\r\n4\r\n7\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}