Read from standard input a natural number n followed by n natural numbers in an array. Rearrange the elements so that:
- all odd numbers appear before all even numbers;
- the odd numbers are sorted in ascending order among themselves;
- the even numbers are sorted in ascending order among themselves.
Print the resulting array, elements separated by spaces.