# -*- coding: utf-8 -*-
"""
Created on Tue Jun  1 20:55:36 2021

@author: Caven
"""


class Solution:
    def searchBST(self, root: TreeNode, val: int) -> TreeNode:
        if not root:
            return root
        if root.val == val:
            return root
        elif root.val > val:
            return self.searchBST(root.left, val)
        else:
            return self.searchBST(root.right, val)