I successfully installed the macOS Mountain Lion (when using the NetBoot it automatically selects the version of macOS with which the iMac was shipped with).
I thought that it would be easy to do but I was mistaken. Recently my sister asked me to reinstall the macOS High Sierra on her iMac because it stopped working correctly.