Several pyrazolo[1,5- a ]pyrimidine, triazolo[1,5- a ]pyrimidine, pyrido[1,2- a ]-benzimidazole, pyrimido[1,2- a ]benzimidazole, pyrazolo[5,1- c ]triazine, triazolo[5,1- c ]-triazine, triazino[4,3- a ]benzimidazole and 1,3,4-thiadiazole derivatives were synthesized via the reactions of ( E )-3-oxo-5-phenylpent-4-enenitrile and the versatile, hitherto unreported ( E )-2-( N,N -dimethylaminomethylene)-3-oxo-5-phenyl-4-pentenenitrile with the appropriate nitrogen and sulfur nucleophiles.