#这题目事先给的这些代码还真是最好不要删呢
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

# @param root TreeNode类 the root of binary tree
# @return int整型二维数组
#
firstArr = []
midArr = []
lastArr = []
class Solution:
    def threeOrders(self , root ):
        # write code here
        res = []
        #前序遍历
        res.append(self.firstSearch(root))
        res.append(self.midSearch(root))
        res.append(self.lastSearch(root))
        return res
#把子函数都弄成类内的成员函数,以供直接调用,也是一种方法吧…(主要可能因为本运行环境特殊)
    def firstSearch(self, root):
        if root != None:
            firstArr.append(root.val)
            self.firstSearch(root.left)
            self.firstSearch(root.right)
        return firstArr

    def midSearch(self, root):
        if root != None:
            self.midSearch(root.left)
            midArr.append(root.val)
            self.midSearch(root.right)
        return midArr

    def lastSearch(self, root):
        if root != None:
            self.lastSearch(root.left)
            self.lastSearch(root.right)
            lastArr.append(root.val)
        return lastArr