favorite We need a little bit of your help to keep things running, click on this banner to learn more

Data Structures contest

Binary Search Tree 1

Implement a balanced binary search tree.


Contains the description of operations on the tree, their number is not greater than 105. Each line contains one of the next operations:

  • insert x - add the key x into the tree. If the key x is already in the tree, do nothing.
  • delete x - delete the key x from the tree. If the tree does not contain the key x, do nothing.
  • exists x - if the key x is in the tree, print "true", otherwise print "false".

All numbers are integers not greater than 109 by absolute value.


Print the result of all operations exists in format given in sample output.

Time limit 3 seconds
Memory limit 128 MiB
Input example #1
insert 2
insert 5
insert 3
exists 2
exists 4
delete 5
Output example #1