# 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