The present invention is directed to novel heterocyclic compounds, their derivatives, pharmaceutically acceptable salts, solvates and hydrates thereof. The compounds and compositions of the present invention have IDHs inhibitory activities and are useful for the treatment of Isocitrate dehydrogenases mediated diseases and conditions. Novel heterocyclic compounds disclosed herein include pyrimidines and triazines.