An isolated system has two phases, denoted by A and B, each of which consists of the same two substances, denoted by 1 and 2. The phases are separated by a freely moving thin wall permeable only by substance 2. Determine the necessary conditions for equilibrium