```
class Solution:
# @param root, a tree node
# @return a list of integers
def postorderTraversal(self, root):
node=root
stack=[]
res=[]
while stack or node:
if node:
res.append(node.val)
stack.append(node)
node=node.right
else:
node=stack.pop()
node=node.left
res.reverse()
return res
```