// editor1
#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
    char data;
    struct node *right,*left;
}node;
node *newnode,*root=NULL;

node* create(char num)
{
    newnode=(node*)malloc(sizeof(node));
    newnode->left=NULL;
    newnode->right=NULL;
    newnode->data=num;
    return newnode;
}

node* insert(node* root,char num)
{
    if(root==NULL)
    {
        return create(num);
    }
    if(root->data > num)
    {
        root->left=insert(root->left,num);
    }
    else if(root->data < num)
    {
        root->right=insert(root->right);
        
    }
    return root;
}
node* inorder(node* root)
{if(root!=NULL)
{
   
    inorder(root->left);
    printf("%d ",root->data);
    inorder(root->right); 
}
}
int main()
{
    int size,i;
    char n;
    scanf("%d",&size);
    getchar();
    for(i=1;i<=size*2;i++)
    {
        scanf("%c",&n);
        if(n== ' ')
        {
            continue
        }
        root=insert(root,n);
        
    }
    inorder(root);
    return 0;
}