#include<iostream>
using namespace std;
//定义结点
typedef struct node{
int date;
struct node * next;
}Node;
//创建头结点
Node *create_node(){
Node * head=(Node*)malloc(sizeof(Node));
//看是否创建成功
if(head==NULL){
return NULL;
}
head->next=head;
return head;
}
//插入结点
void insert_node(Node *head,int a){
Node * pnew=(Node*)malloc(sizeof(Node));
if(pnew==NULL){
return;
}
pnew->date=a;
pnew->next=NULL;
Node *pc;
for(pc=head;pc->next!=head;pc=pc->next);
pnew->next=pc->next;
pc->next=pnew;
}
void out_(Node *head){
if(head->next==head){
return;
}
Node * PK=head->next;
while(PK!=head){
cout<<PK->date<<" ";
PK=PK->next;
}
}
int main(){
Node *head=create_node();
int i,j,n;
cin>>n;
int arr[n];
for(i=0;i<n;i++){
cin>>arr[i];
}
for(j=0;j<n;j++){
insert_node(head, arr[j]);
}
out_(head);
return 0;
}