recursive solution. Trivial.