problem 5 solution

Cheater solution, I intend to implement this programatically at some
point