Beautiful Permutation#5676

Beautiful Permutation

1 second
64 megabytes
Very hard

Consider a permutation of integer numbers from to . Let us call length of the longest monotonic subsequence of the permutation its ugliness.

For example, the ugliness of the permutation <, , , , > is because it has a monotonic subsequence (, , , ) of length , but has none of length . The ugliness of the permutation <, , , , , > is because it has a monotonic subsequence (, , ) of length .

Let us call beautiful those permutations that have a smallest possible ugliness for given . Given , you must find the first in lexicographic order beautiful permutation of size .

Input

Input file contains (1 \le n \le 10000).

Output

Output the first in lexicographic order beautiful permutation of size .

Examples

Example 1

Loading
Loading