#include <stdio.h>
#include <stdlib.h>

struct Node{
    int data;
    struct Node* next;
    struct Node* prev;
};


struct Node* createNode(int value){
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode -> data = value;
    newNode -> next = NULL;
    newNode -> prev = NULL;
    return newNode;
}

void removeDuplicate(struct Node **head) {
    struct Node* curr = *head;
    
    while (curr != NULL) {
        struct Node* temp = curr -> next;
        if (temp -> data == curr -> data) {
            
            temp -> prev -> next = temp -> next;
            temp -> next -> prev = temp -> prev;
            
            
        }
    }
    
    while (curr != NULL) {
        printf("%d ", curr -> data);
        curr = curr -> next;
    }
    
}


int main() {
    
    int n, i;
    struct Node* head = NULL;
    struct Node* tail = NULL;
    if(scanf("%d", &n) != 1 || n < 1 || n > 10) {
        printf("Invalid input");
        return 0;
    }
    
    int arr[n];
    for(i = 0; i < n; i++) {
        if(scanf("%d", &arr[i]) != 1) {
            printf("Invalid input");
            return 0;
        }
        
        struct Node* node = createNode(arr[i]);
        if(head == NULL) {
            head = tail = node;
        } else {
            tail -> next = node;
            node -> prev = tail;
            tail = node;
        }
    }
    
    
    struct Node* curr = head;
    while(curr != NULL) {
        printf("%d ", curr -> data);
        curr = curr -> next;
    }
    
    
    removeDuplicate(&head);
    
    
    
    
}