C.V. Both tanks + pipe + valve. Insulated : Q = 0, Rigid: W = 0
Irreversible due to unrestrained expansion in valve P ↓ but no work out.
If not a uniform final state then flow until P2b = P2a and valve is closed.
Assume no Q between A and B
Now we must assume ma2 went through rev adiabatic expansion