graphviz, uva10160, it seems like a dfs+backtrack+pruning issue. should be easy.