Precision Measurement of Cosmic-Ray Nitrogen and Its Primary and Secondary Components with the Alpha Magnetic Spectrometer on the International Space Station