.
(1) First, I will prove that every element "x" which belongs to set A, belongs to set B, too.
(2) Next, I will prove that every element "y" which belongs to set B, belongs to set A, too.
It will mean that the sets A and B are identical.
Indeed, let x belongs to A.
Then it belongs to (A union B).
Due to condition, it implies that x belongs to (A intersection B).
In turn, it means that x belongs to B.
First statement is proved.
Now I prove the second statement (the proof is the same due to symmetry)
Let y belongs to B.
Then y belongs to (A union B).
Due to condition, it implies that y belongs to (A intersection B).
In turn, it means that y belongs to A.
Second statement is proved.
With two statements proven, the posed problem is solved.