solving 6th problem