#include<stdio.h>
#include<stdlib.h>

typedef struct Node{
    int data;
    struct Node *next;
}node;

node* head = NULL,*tail;

node* insert(int num){
    node* newNode = (node*)malloc(sizeof(node));
    newNode->data = num;
    newNode->next = NULL
    if(head == NULL){
        head = newNode;
    }
    else {
        tail->next = newNode;
    }
    tail = newNode;
}

void display(){
    node* i;
    for(i=head;i!=NULL;i=i->next){
        printf("%d ",i->data);
    }
}

int main(){
    int n,num;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&num);
        insert(num);
    }
    display();
    
    
}
// typedef struct Node{
//     int data;
//     struct Node *left,*right;
// }node;

// node* root = NULL;

// node* create(int num){
//     node* newNode = (node*)malloc(sizeof(node));
//     newNode->data = num;
//     newNode->left = NULL;
//     newNode->right = NULL;
//     return newNode;
// }

// node* insert(node* root,int num){
//     if(root == NULL)return create(num);
//     if(num < root->data){
//         root->left = insert(root->left,num);
//     }
//     else if(num > root->data){
//         root->right = insert(root->right,num);
//     }
//     return root;
// }

// void postOrder(node* root){
//     if(root!=NULL){
//         printf("%d ",root->data);
//         postOrder(root->left);
//         postOrder(root->right);
//     }
// }

// int main(){
//     int n,num,x;
//     scanf("%d",&n);
//     if(n<=0){
//         printf("Invalid input");
//         return 0;
//     }
//     for(int i=0;i<n;i++){
//         scanf("%d",&num);
//         root = insert(root,num);
//     }
//     scanf("%d",&x);
//     root = insert(root,x);
//     postOrder(root);
// }