// editor1
#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 displayList(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,i,data;
    if(scanf("%d",&n)!=1 || n<=o){
        printf("Invalid input");
        return 0;
    }
    struct Node* head=NULL;
    struct Node* tail=NULL;
    for(i=0;i<n;i++){
        if(scanf("%d",&data)!=1 || data<0){
            printf("Invalid input");
            return 0;
        }
        struct Node* newNode=createNode(data);
        if(head==NULL)
           head=newNode;
        else
           tail->next=newNode;
        tail=newNode;
    } 
    displayList(head);
    return 0;
}