problem 4.6.1 from binary trees solved using files and console input