Have an idea?

Skip logic - can't get the script right!

I have a gender question in a survey (let's call it Q1) for which the answer is Male, Female or Prefer not to say. Further down, say after Q4, I want the respondents to fill in a grid, The grid is slightly different depending on how they answered Q1, so a different version for Male, Female and Prefer not to say. So if they answered Male, I need them to go from Q4 to Q5 then Q8 and onward from there. If they are female I need them to go from Q4 to Q6 then Q8 and onward from there. If they said 'Prefer not to say', I need them to go from Q4 to Q7 then on to Q8 and onward from there.

I have tried all types of skip logic script that I can deduce from the guidance, inserted at Qs5, 6 and 7 but they are rejected every time, or cut out all the grid options completely, jumping straight from Q4 to Q8.