Intramolecular cyclization of 2-{[(4-methyl(or 4,6- and 4,8-dimethyl)quinolin-2-yl)sulfanyl]-acetyl}-N-phenylhydrazine-1-carbothioamides in alkaline and acidic media afforded {[(4-methyl(or 4,6- and 4,8-dimethyl)quinolin-2-yl)sulfanyl]acetyl}-substituted 1,2,4-triazoles and 1,3,4-thiadiazoles. The reaction of these compounds with ethyl bromoacetate gave thiazolidinone derivatives.