Deriving Clausius inequality in the case of two reservoirs is quite simple. We assume that there is a thermal machine operating between two reservoirs, the first at temperature $T_1$ and the second at temperature $T_2$ with $T_2 < T_1$.
The whole idea is that we can write the efficiency
$$\eta= 1-\dfrac{Q_2}{Q_1},$$
for that machine and compare with the effiency of a reversible machine operating between the reservoirs:
$$\eta_r = 1 - \dfrac{T_2}{T_1}.$$
By Kelvin's statement of the second law we have $\eta \leq \eta_r$. This implies directly that
$$\dfrac{Q_2}{Q_1}\geq\dfrac{T_2}{T_1}\Longrightarrow \dfrac{Q_1}{T_1}-\dfrac{Q_2}{T_2}\leq 0.$$
But we already know that $Q_2 < 0$ because $Q_2$ is the rejected heat, so that $-Q_2 = |Q_2|$, while $Q_1 = |Q_1|$ because $Q_1 > 0$. This gives Clausius inequality
$$\dfrac{|Q_1|}{T_1}+\dfrac{|Q_2|}{T_2}\leq 0.$$
Now, suppose we want to do it with three reservoirs. That is, we know that a heat $Q_3> 0$ is extracted from a reservoir at $T_3$, heat $Q_2>0$ is extracted from a reservoir at $T_2$ and heat $Q_1 > 0$ is rejected to a reservoir at temperature $T_1$.
I want to derive Clausius inequality, but I don't know how to do, because we have three reservoirs, instead of two. In that case we cannot use the efficiencies directly it seems.
How do we derive this result here?