#include<iostream> int main(){ int a,i; scanf("%d",&a); int b[a],c[a]; for (i=0;i<a;i++) scanf("%d",&b[i]); for (i=0;i<a;i++) { if (b[i]%2!=0) { c[i]=1; } if (b[i]%2==0) { c[i]=0; } } for (i=0;i<a;i++) { if (c[i]==0) { printf("%d ",b[i]); } } printf("\n"); for (i=0;i<a;i++) { if (c[i]==1) { printf("%d ",b[i]); } } return 0; }