#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
typedef struct node{
int data;
struct node*prev;
struct node*next;
} node;
void append(node** head,int value){
node*newnode=(node*)malloc(sizeof(node));
newnode->data=value;
newnode->prev=NULL;
newnode->next=NULL;
if(*head==NULL){
*head=newnode;
}else{
node*temp=*head;
while(temp->next!=NULL){
temp=temp->next;
temp->next=newnode;
newnode->prev=temp;
}
}
void printlist(node*head){
while(head!=NULL){
printf("%d",head->data);
head=head->next;
}
}
int main(){
int n;
if(scanf("%d",&n)!=1||n<=0){
printf("Invalid input");
return 0;
}
node*head=NULL;
for(int i=0;i<n;i++){
int id;
if(scanf("%d",&id)!=1){
printf("Invalid input");
return 0;
}
append(&head,id);
}
printlist(head);
return 0;
}
}