class Solution:
    def Convert(self , pRootOfTree ):
        if not pRootOfTree:
             return None
        def inorder(root):
            if not root: return []
            return inorder(root.left) + [root] + inorder(root.right)
        tmp = inorder(pRootOfTree)
        for i in range(len(tmp) - 1):
            tmp[i].right = tmp[i+1]
            tmp[i+1].left = tmp[i]
        return tmp[0]