Added Q9 solution