One of the well-known data structures to represent sets is a binary search tree. Each node of this tree contains a single element of the set. All elements in the left subtree of must be less than the element in , and all elements in the right subtree of must be greater than the element in . An example of a binary search tree is shown in the figure. A node is called the root if it has no parent (node in the figure). A node is called a leaf if it has no children (nodes , , and in the figure). A path in the tree is a sequence of nodes such that each next node is a direct child of the previous one.

You are given a sequence of distinct integers. Determine whether there exists a binary search tree in which this sequence is a path from the root to some leaf. For example, a search tree path exists, while a path does not.
A sequence of numbers separated by spaces and/or newlines is given. There may be spaces and newlines before the first and after the last number. All numbers are distinct. The number of integers is from to . The values of the numbers are from to inclusive.
Print "YES" if a tree corresponding to the specified path exists, and "NO" otherwise.
Example 1
Example 2