Even after odd linked list

IN this code i am inserting odd elements at start and even at last when taking input. I dont understand which test cases i’m failing.

hi @gaurarjun444 u r not preserving the order
test case
5
1 2 1 2 3
ans should be 1 1 3 2 2