How do I stop thinking about my ex while masterbating?

yes we had the best sexual chemistry but its over, i still get upset over the breakup tho so id very much rather not think about him because it hurts me.
for example yesterday i was doing it and i remembered his existence so i had to stop because i was out of the mood.
i dont always think about him but what do i do for the times that i do.
im not over the breakup so i can't say ‘its okay to fantasize about an ex’ cos no i dont want to fantasize about him im trying to forget him.
How do I stop thinking about my ex while masterbating?
Post Opinion