preorder traversal with difference lists