Even After Odd Linked List

In this problem, should the Linked List be sorted or only just odd elements should come before even elements?
For example:
Input :
5
5 4 3 1 2 3

Which is correct output?
5 3 1 3 4 2
or
1 3 3 5 2 4

?

Hi @sagnikma
5 3 1 3 4 2 this output will be considered correct.