#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef struct node{
int data;
struct node *next;
}no;
no *cre(){
no *head,*p,*tail;
int n;
head=new no;
cin>>n;
tail=head;
while(n!=0){
p=new no;
p->data=n;
p->next=NULL;
tail->next=p;
tail=p;
cin>>n;
}
return head;
}
int main()
{
no *head;
no *p,*q;
head=cre();
p=head;
q=head->next;
while(q!=NULL){
if(q->data%2==0){
p->next=q->next;
delete q;
q=p->next;
}
else if(q!=NULL){//nullpointexception
p=p->next;
q=q->next;
}
}
p=head->next;
while(p!=NULL){
cout<<p->data<<" ";
p=p->next;
}
// cout << "Hello world!" << endl;
return 0;
}