#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#define SIZE 20
//1左 偶
typedef struct hold
{
int sign[SIZE];
int top1,top2;
} HOLD;
int main()
{
HOLD example;
int loop,cycle;
int in;
int log = 0;
example.top2 = 9;
example.top1 = 0;
scanf("%d",&loop);
for(cycle = 0;cycle < loop ;cycle++)
{
scanf("%d",&in);
if(log <= 9)
{
if( in%2 == 0)
{
log++;
example.sign[example.top1] = in;
example.top1++;
}
if( in%2 == 1)
{
log++;
example.sign[example.top2] = in;
example.top2--;
}
}
}
for(cycle = 0;cycle < log ;cycle++)
{
example.top1--;
if(example.top1 >= 0)
printf("%d ",example.sign[example.top1]);
else
{
example.top2++;
printf("%d ",example.sign[example.top2]);
}
}
}
//1左 偶
typedef struct hold
{
int sign[SIZE];
int top1,top2;
} HOLD;
int main()
{
HOLD example;
int loop,cycle;
int in;
int log = 0;
example.top2 = 9;
example.top1 = 0;
scanf("%d",&loop);
for(cycle = 0;cycle < loop ;cycle++)
{
scanf("%d",&in);
if(log <= 9)
{
if( in%2 == 0)
{
log++;
example.sign[example.top1] = in;
example.top1++;
}
if( in%2 == 1)
{
log++;
example.sign[example.top2] = in;
example.top2--;
}
}
}
for(cycle = 0;cycle < log ;cycle++)
{
example.top1--;
if(example.top1 >= 0)
printf("%d ",example.sign[example.top1]);
else
{
example.top2++;
printf("%d ",example.sign[example.top2]);
}
}
}