#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
//Define a structure for a linked list node
typedef struct Node{
    int data;
    struct Node* next;
} Node;
//Function to create a new node
Node* createNode(int data){
    Node* newNode = (Node*)malloc(sizeof(Node));
    if (!newNode){
        printf("Memory error\n");
        return NULL;
    }
    newNode->data = data;
    newNode->next =NULL;
    return newNode;
}
//Function to insert at the end of the linked list
void insert(Node** head, int data){
    Node*newNode =createNode(data);
    if(*head == NULL){
        *head = newNode;
    } else {
        Node* temp =*head;
        while (temp->next){
            temp = temp->next;
        }
    temp->next = newNode;
    }
}
//Function to print the linked list in a single line 
void printList(Node* head){
    while (head) {
        printf("%d",head->data);
        head = head->next;
    }
    printf("\n");
}
int main(){
    int n;
    if (scanf("%d", &n) !=1 || n < -10 || n > 10){
        printf("Invalid input\n");
        return 0;
    }
    Node* head = NULL;
    for (int i = 0; i < n; i++) {
        int num;
        if(scanf("%d", &num)!=1 || num < -1000 || num > 1000){
            printf("Invalid input\n");
            return 0;
        }
        insert(&head, num);
    }
    printList(head);
    return 0;
}
        }
    }
    }
}
    }
}
    }
    }
}
    }
}}
}