added printing levelwise for trees