```
EXPAND_NODE = 1
READ_NODE = 2
def iot(node):
result = []
q = [(EXPAND_NODE, node,)]
while len(q) > 0:
node_type, current_node = q.pop()
if current_node == None:
continue
if node_type == EXPAND_NODE:
q.append((EXPAND_NODE, current_node.right))
q.append((READ_NODE, current_node))
q.append((EXPAND_NODE, current_node.left))
elif node_type == READ_NODE:
result.append(current_node.val)
return result
```