A binary search tree once satisfied the strict BST property, but a glitch swapped the values held at exactly two of its nodes (leaving the tree shape unchanged), so it is no longer a valid BST. Given the corrupted tree in level-order form, identify the two values that were swapped, so that swapping them back would restore a valid strict BST. All values are distinct.
The tree is given in level-order (breadth-first): the tokens list the root, then the children of each node left-to-right, using the token null for a missing child. Trailing null tokens are omitted.
Input format
Line 1: an integer n, the number of level-order tokens.
Line 2: n space-separated tokens, each either an integer value or the literal null. The first token is the root and is never null.
Output format
Two space-separated integers on one line: the two swapped values, in ascending order.
Constraints
- 2 <= n <= 63 (the encoded tree has at least 2 nodes).
- All node values are distinct, each with absolute value <= 1000000.
- The tree is exactly one valid strict BST with two node values swapped.