Sorting

Given a sequence of positive integer numbers, your program must print first the even numbers in increasing order, and then the odd numbers in decreasing order.

Input

The input consists of zero or more cases. Each case consists of a line with at most 10000 integer numbers strictly positive. Each line ends with a 0 that indicates the end.

Output

For each case, your program must print a line with the even numbers in non decreasing order, and in the following line the odd numbers in non increasing order.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:58:49.617Z

© Jutge.org, 2006–2026.
https://jutge.org