solution for P9 and p10