#include <bits/stdc++.h>
using namespace std;
long long b[1000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>b[i];
for (i=1; i<=n; i++)
if (b[i]%2==0) cout<<b[i]<<" ";
cout<<endl;
for (i=1; i<=n; i++)
if (b[i]%2!=0) cout<<b[i]<<" ";
return 0;
}