Let's consider first the case when SW1=open and SW2=closed. Leftmost branch of this circuit is completely dead in this case and A1 reads zero. Now you have effectively only two sources in the circuit and A2 shows some current. Derive the expression for this current using your preferred method (I used superposition principle):
I_A2 = f(R1, R2, R3, R4, R5, R6, U1, U2, U3)
Well, R1, R3 and U3 will not appear in this function for obvious reason, but I left it as most general case.
Then consider the case when SW1=closed and SW2=open. Now rightmost branch is completely dead and A2 reads zero. You have again effectively only two sources in this circuit and now derive equation for current through A1:
I_A1 = f(R1, R2, R3, R4, R5, R6, U1, U2, U3)
Now R2, R4 and U2 are irrelevant a will not appear in this equation.
You have now system of two equations with only two unknown values of R5 and R6, because you measure I_A2 and I_A1 and the rest is given. Solve this system of equations and done.