# -*- coding: utf-8 -*-
"""
Created on Tue Oct 16 10:30:28 2018

@author: 599798
"""

class Node: 
    def __init__(self,key): 
        self.left = None
        self.right = None
        self.val = key 
  
# A utility function to insert a new node with the given key 
def insert(root,node): 
    if root is None: 
        root = node 
    else: 
        if root.val < node.val: 
            if root.right is None: 
                root.right = node 
            else: 
                insert(root.right, node) 
        else: 
            if root.left is None: 
                root.left = node 
            else: 
                insert(root.left, node) 
  
# A utility function to do inorder tree traversal 
def inorder(root,elem): 
    if root: 
        a=inorder(root.left,elem) 
        #print(root.val, end=" ")
        if elem>root.val:
            return False
        else:
            return True
        b=inorder(root.right,elem)
        return (a and b)
r = Node(50) 
insert(r,Node(30)) 
insert(r,Node(20)) 
insert(r,Node(40)) 
insert(r,Node(70)) 
insert(r,Node(60)) 
insert(r,Node(80))
# Print inoder traversal of the BST 
print(inorder(r,-1))