A series of tertiary 3-azido-N-phenylthieno[2,3-b]pyridine-2-carboxamides containing a phenyl or hetaryl moiety at position 4 were synthesized. The influence of the nature of the substituent on the direction of intramolecular cyclization with the participation of nitrene was studied. Novel pyrido[3',2':4,5]thieno[3,2-b][1,5]benzodiazepin-11-ones and benzo[c]thieno[2,3,4-ij][2,7]naphthyridines were synthesized.