Investigation of the acid- and base-induced transformations of nitrogen heterocycles by NMR spectroscopy. 1. Substituted pyridines and pyrimidines