[PLAIN]http://img202.imageshack.us/img202/3227/temperatureentropygragh.jpg
I suppose the most complicated path is the linear process II-III (see attached image) in which both T and S change:
[tex]T(S)= \alpha S + T_0[/tex]
where [tex]\alpha, T_0 >0[/tex] are some constants.
So, in this process we have
[tex]\frac{dS}{dT} = \frac{1}{\alpha}[/tex]
and hence
[tex]\delta Q_{II-III} = TdS = \frac{1}{\alpha} T dT[/tex]
When T changes from [tex]T_1[/tex] to [tex]T_2[/tex] you have
[tex]Q_{II-III} = \frac{1}{\alpha}\int_{T_1}^{T_2} TdT = -\frac{1}{2\alpha} \left(T_1^2 - T_2^2 \right)[/tex]
That is, the heat is extracted in this process.
Now for the process III-I where the entropy is constant it is trivial that [tex]Q_{III-I}=0[/tex]. It is in fact an adiabatic process.
Try to find the heat for isothermal process I-II. Note that the change of the entropy
[tex]S_{II} - S_{I}[/tex]
you can express in terms of [tex]T_2[/tex], [tex]T_1[/tex] and [tex]\alpha[/tex] just from the following equations for III and II points on the graph:
[tex]T_2 = \alpha S_{I} +T_0[/tex]
[tex]T_1 = \alpha S_{II} + T_0[/tex]
Note also that [tex]S_{I}=S_{III}[/tex]