#include<stdio.h>
#include<stdlib.h>

struct Node{
    int data;
    struct Node *next;
};

struct Node* insert(struct Node *head, int value){
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data=value;
    newnode->next=NULL;
    
    
    if(head == NULL){
        return newNode;
    }
        
        struct Node *temp = head;
        while(temp->next != NULL){
        temp = temp->next;
        }
        
        temp->next = newNode;
        return head;
    }
    
    void traverse(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, val;
        struct Node* head = NULL;
        
        scanf("%d", &n); 
         if(n < 0){
            printf("Invalid Input");
            return 0;
        }
        
        for(int i = 0; i < n; i++){
            scanf("%d", &val);
        head = insert(head,val);
    }
    
    traverse(head);
    return 0;
}