Determination of the magnetic structure of hexagonal manganites RMnO3 (R=Sc, Y, Ho, Er, Tm, Yb) by second-harmonic spectroscopy