import java.util.*; /** public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null;

public TreeNode(int val) {
    this.val = val;

}

} */

public class Solution {

static ArrayList<ArrayList<Integer>> resList = new ArrayList<ArrayList<Integer>>();
static ArrayList<Integer> tmpList = new ArrayList<Integer>();

public ArrayList<ArrayList<Integer>> FindPath(TreeNode root,int expectNumber) {
    isSum(root, expectNumber);
    return resList;
}
public static void isSum(TreeNode root,int expectNumber){
    if(root == null){
        return;
    }
    tmpList.add(root.val);

    if(root.left == null && root.right == null && expectNumber - root.val == 0){
        resList.add(new ArrayList(tmpList));
    }
    isSum(root.left, expectNumber - root.val);
    isSum(root.right, expectNumber - root.val);
    
    tmpList.remove(tmpList.size() - 1);
}

}