The median of numbers is defined as the middle number after sorting them in order if is odd. Or it is the average of the middle two numbers if is even. You start with an empty number list. Then, you can add numbers to the list, or remove existing numbers from it. After each add or remove operation, output the median.
For a set of numbers the median is the third number in the sorted set , which is . Similarly, for a set of numbers, , the median is the average of the second and the third element in the sorted set , which is .
The first line is an integer, , that indicates the number of operations. Each of the next lines is either a x or r x. a x indicates that is added to the set, and r x indicates that is removed from the set.
For each operation: If the operation is add, output the median after adding in a single line. If the operation is remove and the number is not in the list, output Wrong! in a single line. If the operation is remove and the number is in the list, output the median after deleting in a single line. (If the result is an integer DO NOT output decimal point. And if the result is a real number, DO NOT output trailing 0s.)
If your median is 3.0, print only 3. And if your median is 3.50, print only 3.5. Whenever you need to print the median and the list is empty, print Wrong!
For each a x or r x, will always be a signed integer (which will fit in 32 bits).
Note: As evident from the last line of the input, if after remove operation the list becomes empty, you have to print Wrong!.