2 test-case gone wrong

how do i rectify error in this code
Here is the link:

Hello @Ekram,
Sample input:
4
2 4 6 8
Correct output: 2 4 6 8
Your Output: 4 8 6 2

Sample Input:
5
1 2 3 4 5
Correct Output: 1 3 5 2 4
Your Output: 1 3 5 4 2

I hope you understand your mistake. Try to resolve it.