Two synthetic strategies are currently known for the preparation of pyrazolo[1,5-a]pyrimidines, as well as other azolopyrimidines: starting either from the pyrimidine ring or from the five-membered ring, and constructing the other heterocycle. 1,2 Thus, syntheses of similar annulated systems from 5-aminopyrazoles and other α-aminoazoles have been described, where reactions with β-dicarbonyl compounds and their derivatives were used. 1,2 For example, synthesis of azolopyrimidines from a pyrimidine derivative was achieved by reacting 2-hydrazinopyrimidines with orthoformate and some other carboxylic acid derivatives. 3,4 During an earlier study of recyclization reactions between pyrimidine derivatives and nitrogen-containing nucleophilic agents, we identified an unusual transformation of 2-(ethoxycarbonyl)methyl-1,4,6-trimethylpyrimidinium iodide (1) in the presence of certain acyl hydrazides, which unexpectedly provided pyrazolo[1,5-a]pyrimidine derivatives. 5 Recently we described such rearrangement in another short report. 6 This previously unknown transformation was performed in a single step by substituting the N(1)-CH 3 fragment in the starting salt with the terminal nitrogen atom of hydrazide group, with subsequent intramolecular cyclization, leading to the formation of pyrazole ring condensed with a pyrimidine ring.In order to investigate the possibility of using this transformation for the synthesis of otherwise unavailable azolyl-substituted pyrazolopyrimidines, we performed the reaction of iodide 1 with hydrazides of azolyl-substituted carboxylic acids 11-19 (Scheme 1), which were prepared by reacting esters of pyrazole-3-carboxylic, (pyrazol-1-yl)-acetic, (1,2,4-triazol-1-yl)acetic, and (pyrazol-1-yl)propionic acids 2-10 with hydrazine hydrate. The subsequent heating of hydrazides 11-19 with iodide 1 in a sealed glass ampoule (at 2:1 stoichiometry) gave the 2-azolyl-and 2-(azolylalkyl)-substituted pyrazolo[1,5-a]pyrimidines 20-28. We should We studied the reaction of 2-(ethoxycarbonyl)methyl-1,4,6-trimethylpyrimidinium iodide with hydrazides of N-azolyl-and С-pyrazolylsubstituted carboxylic acids, which were synthesized by reacting the respective esters with hydrazine hydrate. This reaction was shown to result in recyclization and formation of ethyl 2-(pyrazolylalkyl)-and 2-(azolylalkyl)-5,7-dimethylpyrazolo[1,5-a]pyrimidine-3-carboxylates. Besides pyrazolopyrimidines, the separation of reaction mixture provided in some cases also another recyclization product, 2-hydroxy-5,7-dimethylpyrazolo[1,5-a]pyrimidine.