Add or remove intermediate gears. Every external mesh reverses rotation, so the final direction depends on the engagement count.
Intermediate gears
The amber points mark the active tooth-contact locations. Adjacent gears use exact pitch-circle spacing and complementary tooth phases.