#include<stdio.h>
typedef struct Node
{
int data;
struct Node *next;
}Node,*Linklist;
void CreatL(Linklist &L)
{
Node *s,*r;
int a;
scanf("%d",&a);
L = new Node;
r = L;
while(a!= 0){
s = new Node;
s->data = a;
r->next = s;
r = s;
scanf("%d",&a);
}
r->next = L;
Node *p;
p = L;
while(p->next!= L){
p = p->next;
printf("%d",p->data);
}
}
int main()
{
Linklist L;
CreatL(L);
return 0;
}