Your spaceship: purple
The trick is to use the thrusters to make the spaceship's orbit (purple) match the orbit of Mars (red).
Using the forward thrust raises the orbit on the opposite side of the sun.
Using the reverse thrust lowers the orbit on the opposite side of the sun.
It's pretty easy to make the orbits match; what's hard is to get to Mars' orbit at a point where Mars happens to be at the time!