import java.util.Scanner;

public class Main {

    private static void swap(int[] arr, int a, int b) {
        int tmp = arr[a];
        arr[a] = arr[b];
        arr[b] = tmp;
    }

    private static void output(int[] arr) {
        if (arr == null || arr.length == 0) {
            System.out.println();
            return;
        }
        System.out.println(arr[0]);
        for (int i = 1; i < arr.length; ++i) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        while (in.hasNext()) {
            int n = in.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = in.nextInt();
            }

            int p1 = 0, p2 = 1;

            while (p1 < n && p2 < n) {

                if ((arr[n - 1] & 1) == 0) {
                    swap(arr, p1, n - 1);
                    p1 += 2;
                } else {
                    swap(arr, p2, n - 1);
                    p2 += 2;
                }
            }
            output(arr);
        }
    }
}
心之所向,素履以往 生如逆旅,一苇以航