#include <stdio.h>
#include<stdlib.h>
struct Node{
  int data;
  struct Node*left;
  struct Node*right;
};
struct Node*createNode(int value){
    struct Node newNode=(struct Node*)malloc(sizeof(structNode));
    newNode->data=value;
    newNode->left=newNode->right=NULL;
    return newNode;
}
struct Node*insert(struct Node*root,int value){
    if(root == NULL){
        return createNode(value);
    }
    if(value<root->data){
        root->left = insert(root->left,value);
    }
    else if(value>root->data)
    {
        root->right=insert(root->right,value);
    }
    return root;
}

void inorder(struct Node*root){
    if(root==NULL)return;
    inorder(root->left);
    printf("%d\n",root->data);
    inorder(root->right);
}
int main(){
    int n,i,value;
    struct Node*root=NULL;
    
    if(scanf("%d",&n)!=1){
        printf("Invalid input\n");
        return 0;
    }
    
    if(n<0||n>0){
        printf("Invalid input\n");
        return 0;
    }
    
    if(n==0){
        printf("Tree is Empty\n");
        return 0;
    }
    
    for(i=0;i<n;i++){
        if(scanf("%d",&value)!=1||value<-100||value>100){
            printf("Invalid input\n");
            return 0;
        }
        root=insert(root,value);
    }
    inorder(root);
    return 0;
}