#include <stdio.h>
int main() {
int quantidade;
scanf("%d", &quantidade
); int par[quantidade], impar[quantidade], qtdePar = 0, qtdeImpar = 0;
for (int i = 0; i < quantidade; i++) {
int entrada;
if (entrada % 2 == 0) par[qtdePar++] = entrada;
else impar[qtdeImpar++] = entrada;
}
for (int i = 0; i < qtdePar; i++) {
for (int j = i; j < qtdePar; j++) {
if (par[i] > par[j]) {
int aux = par[i];
par[i] = par[j];
par[j] = aux;
}
}
}
for (int i = 0; i < qtdeImpar; i++) {
for (int j = i; j < qtdeImpar; j++) {
if (impar[i] < impar[j]) {
int aux = impar[i];
impar[i] = impar[j];
impar[j] = aux;
}
}
}
for (int i
= 0; i
< qtdePar
; i
++) printf("%d\n", par
[i
]); for (int i
= 0; i
< qtdeImpar
; i
++) printf("%d\n", impar
[i
]); }
//https://pt.stackoverflow.com/q/262817/101
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBxdWFudGlkYWRlOwogICAgc2NhbmYoIiVkIiwgJnF1YW50aWRhZGUpOwogICAgaW50IHBhcltxdWFudGlkYWRlXSwgaW1wYXJbcXVhbnRpZGFkZV0sIHF0ZGVQYXIgPSAwLCBxdGRlSW1wYXIgPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBxdWFudGlkYWRlOyBpKyspICB7CiAgICAJaW50IGVudHJhZGE7CiAgICAgICAgc2NhbmYoIiVkIiwgJmVudHJhZGEpOwogICAgICAgIGlmIChlbnRyYWRhICUgMiA9PSAwKSBwYXJbcXRkZVBhcisrXSA9IGVudHJhZGE7CiAgICAgICAgZWxzZSBpbXBhcltxdGRlSW1wYXIrK10gPSBlbnRyYWRhOwogICAgfQogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBxdGRlUGFyOyBpKyspIHsKICAgICAgICBmb3IgKGludCBqID0gaTsgaiA8IHF0ZGVQYXI7IGorKykgewogICAgICAgICAgICBpZiAocGFyW2ldID4gcGFyW2pdKSB7CiAgICAgICAgICAgICAgICBpbnQgYXV4ID0gcGFyW2ldOwogICAgICAgICAgICAgICAgcGFyW2ldID0gcGFyW2pdOwogICAgICAgICAgICAgICAgcGFyW2pdID0gYXV4OwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBxdGRlSW1wYXI7IGkrKykgewogICAgICAgIGZvciAoaW50IGogPSBpOyBqIDwgcXRkZUltcGFyOyBqKyspIHsKICAgICAgICAgICAgaWYgKGltcGFyW2ldIDwgaW1wYXJbal0pIHsKICAgICAgICAgICAgICAgIGludCBhdXggPSBpbXBhcltpXTsKICAgICAgICAgICAgICAgIGltcGFyW2ldID0gaW1wYXJbal07CiAgICAgICAgICAgICAgICBpbXBhcltqXSA9IGF1eDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcXRkZVBhcjsgaSsrKSBwcmludGYoIiVkXG4iLCBwYXJbaV0pOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBxdGRlSW1wYXI7IGkrKykgcHJpbnRmKCIlZFxuIiwgaW1wYXJbaV0pOwp9CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8yNjI4MTcvMTAx