private void getPaths(String cur, String end, ArrayList<String> list, int level, Map<String, List<String>> next, ArrayList<List<String>> res)
    {
    	if (cur.equals(end))
    	{
    		res.add(new ArrayList<String>(list));
    	}
    	else if (level > 0)
    	{
    		List<String> parentsSet = next.get(cur);
    		for (String parent : parentsSet) {
    			list.add(parent);
    			getPaths(parent, end, list, level-1, next, res);
    			list.remove(list.size()-1);
    		}
    	}
    }