using namespace std;
struct ll{
int data;
struct ll* next;
};
ll* head=new ll;
void print(ll* temp){
ll* t=temp;
while(t!=NULL){
cout<<t->data<<" ";
t=t->next;
}
}
ll* insert(ll* head,int k){
ll* temp=head;
ll* new1=new ll;
new1->data=k;
new1->next=NULL;
if(temp==NULL){
head=new1;
}
else{
while(temp->next!=NULL){
temp=temp->next;
}
temp->next=new1;
}
return new1;
}
int main(){
head=NULL;
// ll* head;
// head=new ll;
// head=NULL;
int arr[5];
for(int i=0;i<5;i++){
cin>>arr[i];
}
for(int j=0;j<5;j++){
insert(head,arr[j]);
}
cout<<"display elements inserted in ll\n";
print(head);
// two=new ll;
// three = new ll;
// one->next=two;
// two->next=three;
// three->next=NULL;
// head=one;
// one->data=1;
// two->data=2;
// three->data=3;
// //print(head);
// insert(head,4);
// print(head);
return 0;
}