Let's denote the heat quantities and works for the two engines.
For Engine A:
Heat absorbed = $Q_1$ at temperature $T_1$.
Heat rejected = $Q$ at temperature $T$.
Work done, $W_A = Q_1 - Q$.
For a Carnot engine, $\frac{Q}{Q_1} = \frac{T}{T_1} \implies Q = Q_1 \frac{T}{T_1}$.
For Engine B:
Heat absorbed = $Q' = Q/2$ at temperature $T$. (It absorbs half the heat rejected by A).
Heat rejected = $Q_3$ at temperature $T_3$.
Work done, $W_B = Q' - Q_3 = \frac{Q}{2} - Q_3$.
For a Carnot engine, $\frac{Q_3}{Q'} = \frac{T_3}{T} \implies \frac{Q_3}{Q/2} = \frac{T_3}{T} \implies Q_3 = \frac{Q}{2} \frac{T_3}{T}$.
We are given that the work done is equal, $W_A = W_B$.
$Q_1 - Q = \frac{Q}{2} - Q_3$.
$Q_1 + Q_3 = \frac{3}{2}Q$.
Now substitute the expressions for $Q_3$ and $Q$ in terms of $Q_1, T, T_1, T_3$.
First, substitute $Q_3$:
$Q_1 + \frac{Q}{2} \frac{T_3}{T} = \frac{3}{2}Q$.
Rearrange to solve for $Q_1$:
$Q_1 = \frac{3}{2}Q - \frac{Q T_3}{2T} = Q \left( \frac{3}{2} - \frac{T_3}{2T} \right) = Q \left( \frac{3T - T_3}{2T} \right)$.
Now substitute $Q = Q_1 \frac{T}{T_1}$:
$Q_1 = \left( Q_1 \frac{T}{T_1} \right) \left( \frac{3T - T_3}{2T} \right)$.
Cancel $Q_1$ and $T$ from both sides (assuming $Q_1 \neq 0, T \neq 0$):
$1 = \frac{1}{T_1} \left( \frac{3T - T_3}{2} \right)$.
$2T_1 = 3T - T_3$.
$3T = 2T_1 + T_3$.
$T = \frac{2}{3}T_1 + \frac{1}{3}T_3$.