A warehouse tracks distinct shelf heights in a binary search tree. Starting from an empty tree, the heights are inserted one at a time in the order given (standard BST insertion: go left when the new height is smaller than the current node, otherwise go right). Given a target key, report the ceiling of the target: the smallest stored height that is greater than or equal to key.
Input format
Line 1: an integer n, the number of shelf heights.
Line 2: n space-separated distinct integers, the heights in insertion order.
Line 3: an integer key.
Output format
A single integer: the smallest stored height >= key. If no stored height is >= key, print NONE.
Constraints
- 1 <= n <= 40
- All heights are distinct, each with absolute value <= 1000000.
- -2000000 <= key <= 2000000