Determination of the magnetic symmetry of hexagonal manganites by second harmonic generation