#include<stdio.h>
#include<stdlib.h>
typedef struct tree
{
    int data;
    struct tree *left,*right;
}node;
node *create(char c)
{
    node *nd=(node*)malloc(sizeof(node));
    nd->data=c;
    nd->left=nd->right=NULL;
    return nd;
}
node *ins(char c,node*data)
{
    if(root==NULL)
    {
        return create(c);
    }
    if(c<root->data)
    {
        root->left=ins(c,root->left);
    }
    else
    {
       root->right=ins(c,root->right); 
       return root;
    }
    return root;
}
void in(node *root)
{
    if(root==NULL)
    {
        return;
    }
    in(root->left);
    in(root->right);
    printf("%s ",root->data);
}
int main()
{
    node *root=NULL;
    int n,i,size;
    scanf("%s",&size);
    for(i=0;i<size;i++)
    {
        char data;
        scanf("%s",&data);
        root=ins(data,root);
    }
    in(root);
}