Https://hack.codingblocks.com/app/contests/3141/69/problem

#include<bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node* next;
node(int d)
{
data=d;
next=NULL;
}

};

void insertattail(node*&head,node*&tail,int input){
node* newnode=new node(input);
//no element is present
if(head ==NULL){
head=newnode;
tail=newnode;

}
// one element is present
else{
tail->next=newnode;
tail=newnode;
}

}
//to print function bana lete hai
void printll(node* head){
if(head==NULL){
return;
}
while(head!= NULL){
cout<data<<" ";
head=head->next;
}
}
void evenodd(node*&head){
if(head==NULL){
return;
}

//function for swapping 
node* i=head;
node* k=head;
while(i != NULL){
	if(i->data % 2!=0){
	swap(i->data,k->data);
	k=k->next;
}
i=i->next;
}

}

int main() {
node* head=NULL;
node* tail=NULL;
int n;cin>>n;
for(int i=0;i<n;i++){
int input;
cin>>input;
insertattail(head,tail,input);
}
evenodd(head);

printll(head);
return 0;

}

///one testcase is failling but why