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