def MorrisTraversal(root):
# If left child is null, print the
# current node data. And, update
# the current pointer to right child.
print(curr.data, end= " ")
# Find the inorder predecessor
while prev.right is not None and prev.right is not curr:
# If the right child of inorder
# predecessor already points to
# the current node, update the
# current with it's right child
# else If right child doesn't point
# to the current node, then print this
# node's data and update the right child
# pointer with the current node and update
# the current with it's left child
print (curr.data, end=" ")