A highly efficient one-pot synthesis of the 1,2,4,5-tetrasubstituted imidazoles and 2,4,5,6-tetrasubstituted pyrimidines through an arylamidine, malononitrile, and carbonyl compound by using Et3N in CH3CN at reflux conditions was developed. The nature of the carbonyl compounds were different; when the carbonyl compound was arylglyoxal or aryl aldehyde, 1,2,4,5-tetrasubstituted imidazole and 2,4,5,6-tetrasubstituted pyrimidine were achieved respectively.