EVEN-AFTER-ODD Wrong

Code - https://ide.codingblocks.com/s/37925
Ques - https://hack.codingblocks.com/contests/c/511/315
Two Test Cases Are Wrong

Your code is not handling all the test cases.
For input
5
1 5 3 2 4

your code’s ouput is
3 5 1 2 4

but correct output is
1 5 3 2 4

As you just have to display the even numbers after the odd ones, but their relative order should remain the same.