Depth mc

I have more than one holder(mc) on stage. How can I make sure that the mc I won’t on top of the other mc(holder) is. Not by layer but by script.
It’s with swapdepth or getnextdepth or something?Don’t know any help is appreciated