content: import java.util.*;
  import java.io.*;
  
  class Node {
      Node left;
      Node right;
      int data;
      
      Node(int data) {
          this.data = data;
          left = null;
          right = null;
      }
  }
  
  class solution {
  
  /* you only have to complete the function given below.  
  Node is defined as  
  
  class Node {
      int data;
      Node left;
      Node right;
  }
  
  */
      //Method to print nodes of tree in in-order i.e. LEFT-ROOT-RIGHT
      public static void inOrder(Node root) {
          //if node passed becomes null return back
          if(root == null)
              return;
          //Call method for left node
          inOrder(root.left);
          //Print the data of current node
          System.out.print(root.data + " ");
          //Call method for right node
          inOrder(root.right);
      }
  
  	public static Node insert(Node root, int data) {
          if(root == null) {
              return new Node(data);
          } else {
              Node cur;
              if(data <= root.data) {
                  cur = insert(root.left, data);
                  root.left = cur;
              } else {
                  cur = insert(root.right, data);
                  root.right = cur;
              }
              return root;
          }
      }
  
      public static void main(String[] args) {
          Scanner scan = new Scanner(System.in);
          int t = scan.nextInt();
          Node root = null;
          while(t-- > 0) {
              int data = scan.nextInt();
              root = insert(root, data);
          }
          scan.close();
          inOrder(root);
      }	
  }