How to set primary particle of the next interaction

I developing a model coupled with two interactions.
In the first step, a primary particle interacts in the material boundary and generated secondary particles.
And the next step, generated secondary particles in the previous step interacts in the medium as primary particles. Likewise, secondary particles are generated.

But I have a problem, I couldn’t be linked in secondary particles in previous step with primary particles in current step.

Any good ideas to solve this problem?
Any help is greatly appreciated!
Someone who can help I would thank a lot.