Have one container which stores the value you are interested in together with a flag indicating whether it is in A or B.
↧
Have one container which stores the value you are interested in together with a flag indicating whether it is in A or B.