Heterocyclics as corrosion inhibitors for acid media