Solution for training-day problem set.