/* BS TREE TESTER
   Giri Gopalan
   2/17/05 */

import java.io.*;
public class main
{
  public static void main (String[] args)
   {
    tree bs = new tree();  //binary search tree object
    char x;  
    String s;

    try {
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      do  //while loop reads an input String
       {
        s = br.readLine();
        x= s.charAt(0);
       //switch statement to check commands, call methods based on command
        switch(x)
         {
          case 'i':
           bs.insert(s.substring(2));
           break;
          case 'd':
           bs.delete(s.substring(2));
           break;
          case 'c':
           if(bs.check(s.substring(2)))
            System.out.println("true");
           else
            System.out.println("false");
           break;
          case 'p':
           bs.print();
           break;
          default:
           break;
         }
       }
      while(x != 'q');
      br.close();
      }
     catch (Exception e) {
      System.out.println("Ecxeption " + e);
      }
   }
}


