package main
import . "nc_tools"

func isSymmetric( root *TreeNode ) bool {
    // write code here
    return sysmmetric(root, root)
}

func sysmmetric(left, right *TreeNode) bool {
    if left == nil && right == nil {
        return true
    }
    if left == nil || right == nil {
        return false
    }
    if left.Val != right.Val {
        return false
    }

    return left.Val == right.Val && sysmmetric(left.Left, right.Right) && sysmmetric(left.Right, right.Left)

}