Resonances in sinh- and sine-Gordon models and higher equations of motion in Liouville theory