#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node *next;
};
struct node *head = NULL;
struct node* creation(int value)
{
    struct node *newnode= (struct node*)malloc(sizeof(struct node));
        newnode->data = value;
        newnode->next = head;
        return newnode;
}
void insert(int value)
{
    if (head==NULL)
    {
        head=creation(value);
    }
    else{
        
        struct node *temp=head;
        while(temp->next != head)
        {
            temp=temp->next;
        }
        temp=creation(val);
    }
}
int main()
{
    int i,n,val;
    scanf("%d",&n);
    struct node *temp=head;
    for(i=0;i<n;i++)
    {
        scanf("%d",&val);
        insert(val);
    }
    while(temp->next != NULL)
    {
        printf("%d",temp->data);
        temp=temp->next;
    }
}