Wrote query for question 5