#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node *next;
};
void push(sruct Node** head_ref(int new_data){
    struct node*new_node=(struct node*)malloc(size of(struct node));
    new_node->data_new_data;
    new_node->next=*head_ref;
    *head_ref_new_node;
}
void printlist(struct node*node){
    while(node!=NULL){
        printf("%D ",NODE->data);
        node=node->next;
    }
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
struct node* head=NULL;
int value;
for(int i=0;i<n;i++){
    scanf("%d",&value);
    push(&head,value);
}
printlist(head);
return 0;
}