Solution for p31.