In developing the system of data analysis needed to solve the following particular problem. There is a set of integers (initially empty) and a sequence of queries of three types:
- ADD x — add an element x in the set (if an element already exists, then the set does not change)
- DEL x — delete element x from the set (if no such element, then the set does not change)
- FIND — find and display the distance between the two closest elements in the set. This ensures that the set has at least two elements.
Required to fulfill a given sequence of requests.
The first line contains one integerN (1 <= N <= 100 000) — total number of requests. In each of the nextNlines of a written request pursuant to the above format. All numeric values in the query are in the range from1 to 1 000 000 000.
Bring one number in the row for each query typeFIND — the distance between the two closest elements in the set at the time of the query.
7 ADD 1 ADD 5 ADD 4 ADD 6 FIND DEL 5 FIND