Final volume of A and B does not change because the volume is being replaced.
Suppose final % of milk in A and B is 100a% and 100b%.
Total quantity of milk in solution A = Volume of A*(100a)/100 = 100*(100a)/100 = 100a
Total quantity of milk in solution B = Volume of B*(100b)/100 = 200*(100b)/100 = 200b
So, the total quantity of milk = 100a+200b = 100
After removing 40 litre from A now, the amount of milk in A = 60a
After removing 40 litre from A now, the amount of milk in B = 200b+40a
Now, after adding 40 litre from B, the amount of milk in A = 60a + $$\ \frac{\ 40}{240}$$*(200*b+40*a)
Since, the total quantity of milk will remain unchanged even after mixing,
60*a + $$\ \frac{\ 40}{240}$$*(200*b+40*a) = 100a.
On solving we get 200a=200b i.e. a=b. Hence, 300a =100. Thus, a=b=33.33%