Advanced masking with flash?

Let´s say I have 3 layers A, B and C. I want A to be the mask for B which is pretty easy, but at the same time I want B to be the mask for C. Is that possible?

thanks.