```
class Solution:
# @param {TreeNode} root
# @return {integer[]}
def inorderTraversal(self, root):
stack, result = [(False, root),], []
while stack:
read, node = stack.pop()
if node:
if not read:
stack.append((False, node.right))
stack.append((True, node))
stack.append((False, node.left))
else:
result.append(node.val)
return result
```