sketch done
solve() done
trace() done
modify print_trace
extract dfs to a separate module
redesign done