Role of electron-lattice interactions in determining the magnetic structure of insulating manganites