#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
Stuct 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 display(struct Node* head) {
    struct Node* tem=head;
    while (temp !=NULL) {
        printf("%d ", temp->data);
        temp=temp->next;
    }
}
int main() {
    int n;
    if (scanf("%d",&n) !=1) {
        printf("Invalid input");
        return 0;
    }
    if (n<0 || n>10) {
        printf("Invalid input");
        return 0;
    }
    struct Node* head=Null;
    struct Node* tail=Null;
    for (int i=0;i<n:i++){
        int val;
        if(scanf("%d",&val) !=1 || val<0) {
            printf("Invalid input");
            return 0;
        }
        struct Node* newNode =creatNode(val);
        if(head==NULL) {
            head =tail=newNode;
        }
        else {
            tail->next =newNode;
            tail =newNode;
        }
    }
    if (head !=NULL) {
        display(head);
    }
    return 0;
}