#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
    int data;
    struct Node*next;
}Node;
Node*newNode(int data)
{
    Node*newNode=(Node*)malloc(sizeof(Node));
    if(!newNode)
    {
        printf("Memory error\n");
        return NULL;
    }
    newNode->data=data;
    newNode->next=NULL;
    return newNode;
}
void insert(Node**head,int data)
{
    Node*newNode=createNode(data);
    if(*head==NULL)
    {
        *head=newNode;
    }
    else
    {
        Node*temp=*head;
        while(temp->next)
        {
            temp=temp->next;
        }
        temp->next=newNode;
    }
}
void printlist(Node*head)
{
    while(head)
    {
        printf("%d",head->data);
        head=head->next;
    }
    printf("\n");
}
int main()
{
    int n;
    if(scanf("%d",&n)!=1||n<0)
    {
        printf("Invalid Input\n");
        return 1;
    }
    Node*head=NULL;
    for(int i=0;i<n;i++)
    {
        int data;
        if(scanf("%d",&data)!=1)
        {
            printf("Invalid Input\n");
            return 1;
        }
        insertNode(&head,data);
        }
        printList(head);
        return 0;
    }
}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}