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