Second Maximum#2314

Second Maximum

1 second
64 megabytes
Very easy

Implement a binary search tree for integers. The program reads a sequence of integers and builds a tree from them. Elements are inserted into the tree according to the binary search rule. If an element already exists in the tree, do not add it again. The tree is not balanced.

Input

The program receives a sequence of integers. The sequence ends with the number , which indicates the end of input and should not be added to the tree. It is guaranteed that the input sequence contains no more than 10^5 elements, each of which does not exceed 2\cdot 10^9 in absolute value.

Output

Print the second largest element in the constructed tree.

Example corresponds to the following tree:

Examples

Example 1

Loading
Loading