Resonance between passing fast ions and MHD instabilities both in the tokamak and the RFP configurations