Ternary Tree Preorder and Postorder Traversals