from typing import List


class Solution:

    def postorder(self, root: 'Node') ->List[int]:
        arr = []
        if root is None:
            return arr
        elif len(root.children) == 0:
            return [root.val]
        else:
            for child in root.children:
                val = self.postorder(child)
                arr += val
            arr += [root.val]
        return arr

bc0b756159f2be80ee2b47d5c6ab0a221aa8dd75
<mask token>

<mask token>


class Solution:
    <mask token>

<mask token>


class Solution:

    def postorder(self, root: 'Node') ->List[int]:
        arr = []
        if root is None:
            return arr
        elif len(root.children) == 0:
            return [root.val]
        else:
            for child in root.children:
                val = self.postorder(child)
                arr += val
            arr += [root.val]
        return arr

from typing import List


class Solution:

    def postorder(self, root: 'Node') ->List[int]:
        arr = []
        if root is None:
            return arr
        elif len(root.children) == 0:
            return [root.val]
        else:
            for child in root.children:
                val = self.postorder(child)
                arr += val
            arr += [root.val]
        return arr
