Error detection

Sir, kindly point out the error in the following code. Please do not correct the code, I will try to figure that on my own.

Code:

Question:
https://hack.codingblocks.com/app/contests/1982/69/problem

relative order among all odds and all even must remains same.

for test case:
5
1 3 5 7 9
answer should be
1 3 5 7 9

debug for this