slove two tree traversal problem