# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def treeDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def func(root):
if root:
return max(func(root.left),func(root.right))+1
return 0
x=func(root)
return x