Mahesh's submissions for second problem