#NEWLINE# def isSameTree( self , p , q ) : #NEWLINE# #INDENT# '\n        dfs\n        :param p: TreeNode\n        :param q: TreeNode\n        :return: boolean\n        ' #NEWLINE# if ( ( not p ) and ( not q ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if ( ( p . val == q . val ) and self . isSameTree ( p . left , q . left ) and self . isSameTree ( p . right , q . right ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return False