output_description: For each find $k$ operation, print "yes" if $T$ has a node containing $k$,
  "no" if not.
  
  In addition, for each print operation, print a list of keys obtained by
  inorder tree walk and preorder tree walk in a line respectively. Put a space
  character _before each key_.
input_description: In the first line, the number of operations $m$ is given. In the following $m$
  lines, operations represented by insert $k$, find $k$ or print are given.
attempt: import collections
  
  sent = -1
  
  
  def insert(hoge, new_node, root):
      # print(hoge)
      parent_maybe = sent
      now_looking = root
      hoge[new_node]["node_id"] = new_node
      while now_looking != sent:
          parent_maybe = now_looking
          if new_node < hoge[now_looking]["node_id"]:
              now_looking = hoge[now_looking]["left"]
          else:
              now_looking = hoge[now_looking]["right"]
      hoge[new_node]["parent"] = parent_maybe
  
      if parent_maybe == sent:
          root = new_node
          hoge[new_node]["parent"] = sent
          hoge[new_node]["left"] = sent
          hoge[new_node]["right"] = sent
      elif new_node < hoge[parent_maybe]["node_id"]:
          hoge[parent_maybe]["left"] = new_node
          hoge[new_node]["left"] = sent
          hoge[new_node]["right"] = sent
      else:
          hoge[parent_maybe]["right"] = new_node
          hoge[new_node]["left"] = sent
          hoge[new_node]["right"] = sent
  
      return root
  
  
  def inorder(node_id):
      if node_id == sent:
          return None
      inorder(hoge[node_id]["left"])
      print(" {}".format(node_id), end="")
      inorder(hoge[node_id]["right"])
  
  
  def preorder(node_id):
      if node_id == sent:
          return None
      print(" {}".format(node_id), end="")
      preorder(hoge[node_id]["left"])
      preorder(hoge[node_id]["right"])
  
  
  def getTree(root):
      inorder(root)
      print()
      preorder(root)
      print()
  
  
  def searchNode(hoge, num, node_id):
      if node_id == -1:
          return "no"
  
      if num == node_id:
          return "yes"
      elif num < node_id:
          return searchNode(hoge, num, hoge[node_id]["left"])
      elif num > node_id:
          return searchNode(hoge, num, hoge[node_id]["right"])
  
  
  if __name__ == "__main__":
      num = int(input())
      hoge = collections.defaultdict(dict)
      root = -1
      for _ in range(num):
          command = input()
          if command.split()[0] == "insert":
              root = insert(hoge, int(command.split()[1]), root)
          elif command.split()[0] == "find":
              print(searchNode(hoge, int(command.split()[1]), root))
          else:
              getTree(root)
  
problem_description: Binary Search Tree II
  
  Write a program which performs the following operations to a binary search
  tree $T$ by adding the find operation to A: Binary Search Tree I.
  
    * insert  $k$: Insert a node containing $k$ as key into $T$.
    * find $k$: Report whether $T$ has a node containing $k$. 
    * print: Print the keys of the binary search tree by inorder tree walk and preorder tree walk respectively.
samples: [{"input": "10\n    insert 30\n    insert 88\n    insert 12\n    insert 1\n    insert 20\n    find 12\n    insert 17\n    insert 25\n    find 16\n    print", "output": "yes\n    no\n     1 12 17 20 25 30 88\n     30 12 1 20 17 25 88"}]