Package main;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
int N = Integer.parseInt(READER.readLine());
int[] array = new int[N];
for(int i = 0; i < array.length; ++i)
array[i] = Integer.parseInt(READER.readLine());
Main.function(array);
for(int i = 0; i < array.length; ++i)
System.out.println(array[i]);
}
public static void function(int[] array) {
int first=0, last=0, temp;
for(int i = 0; i < array.length; ++i)
if(array[i] % 2 == 0) {
first = i;
break;
}
for(int i = array.length - 1; i > 0; --i)
if(array[i] % 2 == 0) {
last = i;
break;
}
temp = array[first];
array[first] = array[last];
array[last] = temp;
}
}