// editor2
#include<stdio.h>
#include<stdlib.h>

typedef struct TreeNode
{
    int data;
    struct TreeNode *left,*right,*root;
}node;

void create(int n)
{
    node *nd=(node*)malloc(sizeof(node));
    nd->data=n;
    nd->left=nd->right=NULL;
    return nd;
}

void *ins(int n,node *root)
{
    if(root=NULL)
    {
        return root;
    }
    if(n<root->data)
    {
        root->left=ins(n,root->right);
    }
    return root;
}
void postorder(TreeNode*node)
{
    if(node==NULL)
    {
        return; 
    }
    postorder(root->left);
    postorder(root->right);
    printf("%d",node->data);
}
int main()
{
    int n,i;
    scanf("%d",&n);
    if(n<0)
    {
        printf("Invalid input");
        return 0;
    }
    for(i=0;i<n;i++)
    {
        int data
        scanf("%d",&data);
        root=ins(data,root);
        
    }
    postorder(root);
    return 0;
}