#include <stdio.h>
#include <stdlib.h>

struct Node {
    int data;
    struct Node* next;
};

struct Node* createNode(int val) {
    struct Node* n=(struct Node *)malloc(sizeof(struct Node));
    n->data=val;
    n->next=NULL;
    
    return n;
}
void insertElements(struct Node** head,int a) {
    struct Node* newNode=createNode(a);
    if(*head==NULL){
        *head=newNode;
        return;
    }
    struct Node* temp=*head;
    while(temp->next !=NULL){
        temp=temp->next;
    }
    temp->next=newNode;
}
void display(struct Node* head){
    struct Node*temp=head;
    
    while(temp!=NULL){
        printf("%d\n",temp->data);
        temp=temp->next;
    }
}

int main(){
    struct Node* head=NULL;
    int n;
    scanf("%d",&n);
    if(n<=0) {
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++){
        int a;
        scanf("%d",&a);
        insertElements(&head,a);
    }
    display(head);
    return 0;
}
    }
        
    }
}
    }