Finished probem 167_hard