AC
#include <iostream>
using namespace std;
#include <stdio.h>
#include<stdlib.h>
typedef struct lnode{
int data;
lnode *next;
}lnode;
lnode* initial(){
lnode *head;
head = (lnode *)malloc(sizeof(lnode));
head->next=NULL;
return head;
}
lnode* create(lnode *head,int n){
lnode *tail,*p;
tail=head;
while(n--){
p=(lnode *)malloc(sizeof(lnode));
scanf("%d",&p->data);
p->next=NULL;
tail->next=p;
tail=p;
}
return head;
}
void output(lnode *head){
lnode *p;
p=head->next;
while(p){
if(p->next) cout<<p->data<<" ";
else cout<<p->data<<"\n"<<endl;
p=p->next;
}
}
int main()
{
int n;
lnode *head;
head=initial();
cin>>n;
head=create(head,n);
output(head);
return 0;
}