Update solution.

The original one is wrong since it only tries one single path.