Close numbers#457

Close numbers

3 seconds
64 megabytes
Medium

In developing a data analysis system, you are given the following partial task. You have a set of integers (initially empty) and a sequence of queries of three types:

Process the given sequence of queries.

Input

The first line contains one integer (1 \le N \le 100\ 000): the total number of queries. Each of the next lines contains one query in the format described above. All numerical values in the queries are in the range from to .

Output

For each query of type FIND, output one number: the distance between the two closest elements in the set at that moment (one number per line).

Examples

Example 1

Loading
Loading