#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

struct Node
{
    int data;
    struct Node*next;
};
struct Node* createNode(int data)
{
    struct Node*newNode=(struct Node*)malloc(sizeof(struct Node));
    newNode->data=data;
    newNode->next =NULL;
    return newNode;
}
void printlist(struct Node*head)
{
    struct Node*temp=head;
    while (temp!=NULL)
    {
        printf("%d",temp->data);
        if(temp->next !=NULL)
        {
        printf(" ");
        }
    temp = temp->next;
    }
}
int main()
{
    int n;
    if(scanf("%d",&n)!=1)
    {
        printf("Invalid input");
        return 0
    }
    struct Node*head=NULL;
    struct Node*tail=NULL;
    for(int i=0;i<n;i++)
    {
        int x;
        if(scanf("%d" ,&x)!=1)
        {
            printf("Invalid input");
        
        }
        struct Node*newNode=createNode(x);
        if(head==NULL)
        {
            head =newNode;
            head=newNode;
        }
        else
        {
            tail->next=newNode;
            tail=newNode;
        }
    }
    printlist(head);
    return 0;
}