Solve problem 166