Problems

# Similar numbers

# Similar numbers

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.

**Input**

The first line contains one integer**N** (**1** <= **N** <= **100 000**) — total number of requests. In each of the next**N**lines of a written request pursuant to the above format. All numeric values in the query are in the range from**1** to **1 000 000 000**.

**Output**

Bring one number in the row for each query type**FIND** — the distance between the two closest elements in the set at the time of the query.

Input example #1

7 ADD 1 ADD 5 ADD 4 ADD 6 FIND DEL 5 FIND

Output example #1

1 2