private ArrayList<ArrayList<Integer>> removeDuplicated(ArrayList<ArrayList<Integer>> input) {
        HashSet<ArrayList<Integer>> set = new HashSet<ArrayList<Integer>>();
        ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
        for(ArrayList<Integer> o : input){
            if(set.add(o))
                result.add(o);
        }
        return result;
    }