#include<iostream>
#include<cstdlib>
using namespace std;
typedef struct DuLNode {
int data;
DuLNode *prior,*next;
};
void InitSList(DuLNode *&SL) {//初始化双链表
SL=(DuLNode*)malloc(sizeof(DuLNode));
SL->prior=SL->next=NULL;
}
void createSList(DuLNode *&SL) {//创建双链表
DuLNode *s,*r;
r=SL;
while(1) {
s=( DuLNode*)malloc(sizeof(DuLNode));
cin>>s->data;
if(s->data==-1)break;
r->next=s;
s->prior=r;
r=s;
}
r->next=NULL;
}
void showSList(DuLNode *&SL) { //输出双链表
DuLNode *p=SL->next;
while(p) {
cout<<p->data<<" ";
p=p->next;
}
cout<<endl;
}
int main() {
DuLNode *SL;
InitSList(SL);
createSList(SL);
showSList(SL);
return 0;
}