class Solution: def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: